Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fucking GCC warnings

Name: Anonymous 2010-11-12 13:54

request for implicit conversion from ‘void *’ to ‘struct keys *’ not permitted in C++

keys = mmap(0, sizeof(struct keys), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);

First: C99 code (-x c -std=c99).
Second: what is going on?

Name: Anonymous 2010-11-13 9:37

>>19
No, you're brain-washed by C++ idiots. Casts from void * are fucking useless.

I maintain a fairly large program, and it probably contains less than 100 casts. Most of those are to work around stupidities with other code that isn't written properly.

Every time I have removed a cast from the code, I have discovered that it was hiding a glaring bug, like casting away a const, passing the resulting pointer to another function where it was saved for later manipulation, which would occasionally crash because it was trying to write to unwritable memory locations. Bullshit like that would never happen if people avoided useless casts of the sort you're recommending.

By the way, my program builds clean with every single GCC warning enabled, save the ridiculously pedantic diagnostics that are prone to giving loads of false positives (such as -Wstrict-overflow).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List