Isn't this something similar to vala ?
Vala has an own seperate transpiler that generates C code from Vala code.
Cello uses the normal C preprocessor to generate C code.
111–120 of 158 posts
Isn't this something similar to vala ?
Vala has an own seperate transpiler that generates C code from Vala code.
Cello uses the normal C preprocessor to generate C code.
Earlier quoted context omitted.
It's arguable that extensive use of macros and faux-dynamic-typing violate the ideology of C that makes it simple and predictable.
I'd remove the “faux”. Cello is dynamically typed.
How about performance? As I understand, it uses fat pointers fat pointers and GC, so performance drop is expected. There are not many reasons to use C nowadays beside performance.
portability? stable ABI? ... writing something in C make it easy for any other higher level language to link to it. That's why we're not done with C, at all ... it's basically the only serious language out there used to share code among every possible platform or language. Even C++ which is a bit safer in practice is harder to link.
I just wished C was a bit safer by default (arrays with bound checking,...)
Isn't this something similar to vala ?
No not really. Vala has an own seperate transpiler that generates C code from Vala code. Cello uses the normal C preprocessor to generate C code.
To me C is obsolete and most people who have a "reason" to use C don't really have a real reason other than stupidity. C++ does everything that C does except only better.
;-)
Take a turd and roll it in sugar it's still a turd. To me C is obsolete and most people who have a "reason" to use C don't really have a real reason other than stupidity. C++ does everything that C does except only better. ;-)
Earlier quoted context omitted.
> So, for example, you know if at offset 0xDEADBEEF there is are 8 bytes which are holding a number that you want to use, you can access that chunk of memory and use it however you want. And you can interpret it how it is appropriate for your use case, for example reading it into a string, or an int. Except these days with strict aliasing that's not true. If you access memory through a pointer of the wrong type, you'…
'Strict aliasing' is a dangerous optimisation that OpenBSD's gcc-local disables for a reason.
Essentially, what strict aliasing rule requires is that user cannot go crazy casting pointers. Casting float pointer to int pointer is completely wrong. The exception is that it's completely safe to cast values to char pointer or void pointer (and back, but only to original type of a pointer). Objects of different types cannot use the same memory area.
What this usually affects is code that parses external data into a structure. This can be dealt with by use of `memcpy` (to copy data from char array into a structure) instead of pointer casts, which is mostly safe as far C specification is concerned (mostly because C specification doesn't really define stuff like paddings, so you need to be careful about that). There is also an option of using `union` which is allowed by C11 specification (but compilers released with C11 that had strict aliasing optimization didn't break code that had aliasing through union and even documented that).
Earlier quoted context omitted.
C++ isn't strictly a superset of C! Which I always found crazy. Some C will not compile for C++.
Can you provide C code that will not compile with c++ compiler?
$ cat foobar.c
#include
struct foo {
int x;
int y;
};
int foobar(struct foo *f)
{
return f->x + f->y;
}
int
main(int argc, char *argv[]) {
(void)argc; (void)argv;
printf("%d\n", foobar(&(struct foo){10, 20}));
return 0;
}
$ gcc -Wall -Wcast-align -Wextra -pedantic -std=c99 foobar.c -o foobar && ./foobar
30
$ g++ -Wall -Wcast-align -Wextra -pedantic foobar.c -o foobar && ./foobar
foobar.c: In function ‘int main(int, char**)’:
foobar.c:17: warning: ISO C++ forbids compound-literals
foobar.c:17: warning: taking address of temporary
30
$ # taking address of temporary means that it's undefined behavior
[0] https://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html