On Thu, 28 Sep 2006, Nelson H. F. Beebe wrote:

> The gcc folks could probably argue that -- is indeed ambiguous,
> because there is no way to tell which of the following arguments are
> intended for the preprocessor, the compiler, the assembler, or the
> linker.  There are already -W[x],-option,value options to direct
> arguments to specific components.

It's not ambiguous; the following arguments should all be treated as input 
files, not options, and whether the input files are compiled (and as what 
language) or linked is determined by their suffixes in the documented 
manner.  Thus

    gcc -- -foo.c -lbar

should compile the C source file "-foo.c" and link the resulting object 
with the object file called "-lbar" (not with the library libbar.a).  
This does require passing the "--" through to the linker (and I don't know 
if the linker supports -- as would be required), or rewriting the command 
as the equivalent

    gcc ./-foo.c ./-lbar

-- 
Joseph S. Myers
[EMAIL PROTECTED]


Reply via email to