Liste des Groupes | Revenir à cl c |
On 27/02/2025 16:13, Ar Rakin wrote:Problems involving \ and // commonly come up with multi-line macros. Suppose your macro looks like this:On 2/27/25 8:16 PM, Scott Lurndal wrote:Like most quirks, as found in every language, you have to be very unlucky to be hit by it, and extraordinarily unlucky to do so without it being immediately obvious when you compile your code or at least when you try to run it. And it's peanuts to avoid triggering it once you know about it - but most people can spend their entire careers as C programmers without ever coming across it.Ar Rakin <rakinar2@onesoftnet.eu.org> writes:>bart <bc@freeuk.com> writes:>
>// isn't devoid of quirks (this is still C after all), for example:>
>
fopen(file,"rb"); // open file in \windows\system32\
fread(...);
>
Here, the // line continues onto the next, so that the fread is
commented out. But they are fewer.
Interesting. Isn't this considered a compiler bug?
No, it is standard C line continuation behavior remaining from
the days of punched cards. More useful for strings
and invented prior to the invention of unterminated comments (//).
>
Understood.
>
Even though I have been writing C code for around four years now, I still learn new things about this *simple* language every day.
>
These things can be inconvenient for people making C tools (compilers, syntax highlighters, etc.), but are rarely a problem for C programmers.
Les messages affichés proviennent d'usenet.