Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: Strange compiler warnings?

2007-04-17 by Dave Hylands

Hi guys,

On 4/17/07, kernels_nz <kernels@slingshot.co.nz> wrote:
> Excellent catch about using comments in defines, it has caught me out
> in the past because:
>
> #define max 100 //largest value
>
> in the line
>
> for (count = 0; count < max; count++)
>
> will turn into something like:
>
> for (count = 0; count < 100 //largest value; count++)
>
> which obviously wouldnt work.

Actually, that should work just fine. Because according to the
language specification comments are supposed to be treated as white
space.

I know that GCC will actually replace comments with whitespace prior
to passing the code onto the compiler. Perhaps other compilers aren't
doing the right thing...

-- 
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.