gpc -fexecutable-file-name -x Pascal fooo
happily overwrites input file. I am not sure if we consider this a bug or a feature.
Waldek Hebisch wrote:
gpc -fexecutable-file-name -x Pascal fooo
happily overwrites input file. I am not sure if we consider this a bug or a feature.
This looks like the one on page 32 of the UNIX-Haters Handbook (http://web.mit.edu/~simsong/www/ugh.pdf), where you accidentally type
% cc -o doit.c doit
instead of
% cc -o doit doit.c
Regards,
Adriaan van Os
Adriaan van Os wrote:
Waldek Hebisch wrote:
gpc -fexecutable-file-name -x Pascal fooo
happily overwrites input file. I am not sure if we consider this a bug or a feature.
This looks like the one on page 32 of the UNIX-Haters Handbook (http://web.mit.edu/~simsong/www/ugh.pdf), where you accidentally type
% cc -o doit.c doit
instead of
% cc -o doit doit.c
Yes, the issues are similar: there is reasonably simple description telling you what cc is supposed to do and cc is doing exactly that. However, there is some difference: in case of cc safety measures may block otherwise usefull (and legal) behaviour. I mean: you need an oracle to distinguish between trash and a valuable source.
In our case -fexecutable-file-name strips a suffix from input file name and uses the result as executable name. If there is no suffix input file name is used unchanged. Strange thing is that with Pascal sources this works reliably: output is created by the linker only after the whole input was consumed.
Now, I wonder how usefull -fexecutable-file-name is for inputs without suffix. It actually may do usefull things if output directory is different from input directory. OTOH a simple way avoid overwriting input is to disallow input name without a suffix when -fexecutable-file-name is in force.
On 16 Nov 2005 at 16:21, Waldek Hebisch wrote:
[...]
OTOH a simple way avoid overwriting input is to disallow input name without a suffix when -fexecutable-file-name is in force.
Seems fine to me.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/