getc in BSD (was FLEX issues)

Randall Hyde randyhyde at
Wed Jul 5 20:28:48 UTC 2006

-----Original Message-----
>From: Steve Kargl <sgk at>
>Sent: Jul 4, 2006 11:40 AM
>To: Randall Hyde <randyhyde at>
>Cc: freebsd-hackers at
>Subject: Re: getc in BSD (was FLEX issues)
>On Mon, Jul 03, 2006 at 11:34:41AM -0700, Randall Hyde wrote:
>> The error reported is "syntax error before numeric constant".
>> This kind of gives me the impression that "getc" is defined a bit
>> differently under FreeBSD than other environments?  Any ideas?
>As others have stated, getc() is implemented via a macro,
>which may depend on other macros.  In reading the flex 
>NEWS file, I ran across the -Cr option.  I added this 
>option to your flex command, and the hla.flx file is 
>processed and produces a compilable lex.yy.c.

Yeah, getc was the problem. I modified flex (via one the various macros it defines) to emit fgetc rather than getc and the problem went away.  I'll have to try the -Cr option and see what happens there.
Randy Hyde

More information about the freebsd-hackers mailing list