News for hackers. Stuff that matters.
Re:A bug story: data alignment in C on x86 (2016) by AnimalMuppet on Tuesday September 04, 2018 @08:47PM (#17914205)
Which you are going to use how? Don't you have to cast it to something to be able to use it?
Re:A bug story: data alignment in C on x86 (2016) by deathanatos on Tuesday September 04, 2018 @09:14PM (#17914334)
No, you don't. The following,

    int *i = malloc(sizeof(int));
is valid C, and will compile just fine. I think it's considered good form, too, as the cast doesn't really add anything not already present, and might even drift out of date with the surrounding code. (And just gets in the way of legibility.)

IIRC, it is not valid C++. But malloc()/void * is somewhat rarer to find there, as you have better options.

Re:A bug story: data alignment in C on x86 (2016) by shakna on Tuesday September 04, 2018 @09:21PM (#17914379)
That's an implicit cast from void * to int * .

    void *malloc(size_t size);
Re:A bug story: data alignment in C on x86 (2016) by tedunangst on Tuesday September 04, 2018 @10:04PM (#17914555)
In standard parlance, that is a conversion. Only (this) is a cast.
Re:A bug story: data alignment in C on x86 (2016) by caf on Tuesday September 04, 2018 @10:04PM (#17914552)
There's no such thing as an "implicit cast". A cast is an explicit conversion (a cast expression), and the assignment expression discussed here has an implicit conversion.