[Top][All Lists]

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

Re: [Tinycc-devel] Options issues

From: Rob
Subject: Re: [Tinycc-devel] Options issues
Date: Tue, 19 Apr 2011 11:01:34 +0100

On 19 April 2011 02:51, Luis Alejandro Muzzachiodi
<address@hidden> wrote:
> After many mistyping working with tcc i'm found some issues with the CL's 
> options:
> [references:   ->  is in , <- is out]

I don't see a problem with any of these.

> 1) Default extensions
> If
> -> tcc -c hello.c
> <- file «hello.o» (object)
> According documentation option -o must be given. But the name and the 
> extension is figured out for default(nice). However
> -> tcc -o hello -c hello.c
> <- file hello (object)
> doesn't adds .o (even with the option -o present)
> or
> ->tcc -o hello hello.c
> <-file «hello» executable
> Why doesn't adds (or fixs if outfile has other extension)  ".exe"? (Windows)

It shouldn't really add the extra bit if you didn't tell it to. What if
you're writing a script and expect it to output to hello instead of
hello.o? Trying to second guess what output file tcc creates, rather
than trusting the -o option is a bad idea.

> 2) Ambiguity
> If
> tcc -o -c hello.c
> -> file -c (executable)
> -c is an option or outfile's name.?.
> By default would be an option (though may be optionally the outfile's name 
> with «tcc -o -c -c hello.c», for example).

PEBKAC - tcc documentation says the output filename is given after -o,
thus it is obeyed. tcc shouldn't have to compensate for users not
understanding command line arguments. Sure, perhaps a warning could
be omitted if the output begins with a -, but I really don't think tcc should
try to second guess the user.

> 3) Overwriting
> If
> ->tcc -o hello.c -c hello.c
> <- file hello.c (object)
> the original hello.c is missing!.
> Overwrite the outfile's extension (or add if not) with the default extension 
> .o would be a safe alternative.

The user should check this, it's not really tcc's problem, tcc isn't a
file manager, it's a compiler (again, altering the output filename
without telling the user it just unpredictable and plain wrong - what if
it's called from a Makefile to overwrite an older object file?).

> 4) Stdin with run
> According to documentation «-» replaces stdin for infile with the option 
> "run". However,
> ->tcc -
> ->^V
> <-stdin:1: error: unrecognized character \x16

I don't see the problem, ^V is an invalid character for C.

> or
> -> tcc -
> ->^Z
> <-tcc: error: undefined symbol 'main'.

You haven't defined main, hence the tcc can't complete compilation.

> tcc begin to read stdin.
> Adding some option
> ->tcc - hello.c
> -> ^Z
> <- file a.exe (executable)
> or
> ->tcc - -c
> -> ^Z
> <- file a.out (object)

There's no problem here, in the first one, main() is presumably in
hello.c, and this is linked with the empty file from stdin, outputted to
In the second one, an empty input is compiled into object code,
perfectly legal, and no errors, since there is no linking and hence
main() doesn't need to be resolved.

Those are my personal opinions, but I don't see a problem with
anything you've said.


reply via email to

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