Sujet : Re: A Famous Security Bug
De : anton.txt (at) *nospam* g{oogle}mail.com (Anton Shepelev)
Groupes : comp.lang.cDate : 28. Mar 2024, 10:23:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240328122327.3895243496305c8cc8a9d063@g{oogle}mail.com>
References : 1 2 3 4
User-Agent : Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Kaz Kylheku:
If C compilers warned about every piece of dead code that
is eliminated, you'd be up to your ears in diagnostics all
day.
Is so much dead code a defect in the source or a benigh
consequence of a well-pondered decision?
If you do want the code deleted, that doesn't always mean
you can do it yoruself. What gets eliminated can be target
dependent:
>
switch (sizeof (long)) {
case 4: ...
case 8: ..
}
The case above is IMHO best handled by conditional
compilation, even though more work may be required to
dispatch on a type size in the preprocessor.
Because memset is part of the C language, the compiler
knows exactly what effect it has (that it's equivalent to
setting all the bytes to zero, like a sequence of
assignments).
Yes, it is an instance of a special case relying upon hard-
coded information. Why not, however, let the programmer
elimitate this dead code from his code, if it /is/ dead?
-- () ascii ribbon campaign -- against html e-mail/\ www.asciiribbon.org -- against proprietary attachments