[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: With a wacky macro before it, 'global' appears to miss a function
From: |
Ezolt, Phillip |
Subject: |
Re: With a wacky macro before it, 'global' appears to miss a function |
Date: |
Sun, 24 Apr 2011 07:38:17 -0400 |
Shigio,
On Apr 24, 2011, at 2:23 AM, "Shigio YAMAGUCHI" <address@hidden> wrote:
>> That seems a little dangerous to me. I could easily see someone adding an e=
>> xtra line after a function definition by accident, and being completely con=
>> fused when that function doesn't show up. (leading to another bug report..)
>> ...
>>
>> Alternatively, would it be possible to use the semicolon at the end of the S=
>> TRUCT_DEF_MACRO to stop the parsing of that function? (so we move on to the
>> n=
>> ext function..)
>>
>> The rule should be something like: If we hit a semicolon, and we don't have=
>> any open braces, then consider the function to be complete..
>
> It is a good rule.
> However, may I throw away K&R style?
Ouch. Yeah... we don't want to do that. I think we need k&r support.
>
> 1. ANSI style
> -------------
>
> int
> main(int argc, char **argv) {
> printf("Hello\n");
> }
>
> 2. K&R(old) style
> -----------------
>
> int
> main(argc, argv)
> int argc;
> char **argv;
> {
> printf("Hello\n");
> }
>
> If we need not support K&R, I would like to adopt your rule.
> What do you think?
Ok.. Ok. How about THIS rule.. (if this even possible?)
If we see a semicolon, AND then we see an open paren BEFORE we see an open
brace, we know the token before the paren is a function and the previous
function is complete?
That would catch this:
A() bob;
int foo() <==== this paren means the previous symbol is complete
{
}
...
But not k and r:
A(bar)
int bar;
{
}
> --
> Shigio YAMAGUCHI <address@hidden>
> PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3
Cheers,
--Phil
- Re: With a wacky macro before it, 'global' appears to miss a function,
Ezolt, Phillip <=
- Re: With a wacky macro before it, 'global' appears to miss a function, Shigio YAMAGUCHI, 2011/04/24
- Re: With a wacky macro before it, 'global' appears to miss a function, Phillip Ezolt, 2011/04/25
- Re: With a wacky macro before it, 'global' appears to miss a function, Shigio YAMAGUCHI, 2011/04/26
- Re: With a wacky macro before it, 'global' appears to miss a function, Marc Herbert, 2011/04/27
- Re: With a wacky macro before it, 'global' appears to miss a function, Shigio YAMAGUCHI, 2011/04/27
- Re: With a wacky macro before it, 'global' appears to miss a function, Ezolt, Phillip, 2011/04/27
- Re: With a wacky macro before it, 'global' appears to miss a function, Marc Herbert, 2011/04/28
- Re: With a wacky macro before it, 'global' appears to miss a function, Shigio YAMAGUCHI, 2011/04/28
- Re: With a wacky macro before it, 'global' appears to miss a function, Marc Herbert, 2011/04/29
- Re: With a wacky macro before it, 'global' appears to miss a function, Shigio YAMAGUCHI, 2011/04/29