help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %option stdinit


From: John W. Millaway
Subject: Re: %option stdinit
Date: Wed, 6 Mar 2002 11:40:39 -0800 (PST)

> Anyone have any thoughts on this?

This is not a bug. The user misunderstands the purpose of %option stdinit. The
option does exactly what it is supposed to do -- It initializes yyin/out to
stdin/out, STATICALLY. This is to FORCE static initialization. 

The advice to this user is:  Don't use %option stdinit if your libc doesn't
define stdin/out as compile-time constants. Flex already does what you want, by
default, at runtime (safely).

On the first invocation of yylex(), flex checks if yyin and yyout are NULL,
which they are, initially, unless %option stdinit was specified. If either yyin
or yyout are NULL, then flex initializes them to stdin and stdout.

In reality, there is no reason to ever use %option stdinit, unless, for some
reason, you need them to be initialized during linking. The option is present
for backwards compatibility, as noted in the flex manual.

-John


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]