[Dev-C++] gcc, BC++ and wildcards on Win98
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <gi...@li...> - 2002-03-04 17:04:06
|
Hello list,
A few days ago, I mailed a message about the fact that the same C code,
when compiled with GNU gcc and executed generated output different from the
one generated by compiling the same source code with BC++.
The source was:
/* echo.c */
#include <stdio.h>
int
main(int argc, char **argv)
{
while (--argc)
printf("%s%c", *++argv, (argc > 1) ? ' ': '\n');
return 0;
}
And to produce different output I did the following:
1. compiled the code using the commands: (I had both compilers in my path)
gcc -oecho_g.exe echo.c
bcc32 -eecho_b.exe echo.c
2. generated different output issuing the commands:
echo_g *.c
echo_b *.c
The result of the first command was what I expected: all files with a ".c"
extension, found in the current directory, where listed. The result of the
second command was simply the string "*.c". I was told to link the BC++
compiled program against the object file "wildargs.obj", which is shipped
with BC++ as an object. In fact when I generated the "echo_b.exe" using:
bcc32 -eecho_b.exe echo.c wildargs.obj
the output of "echo_b *.c" was the same as the one generated by echo_g.exe.
Now here is the surprise (at least for me): if the current directory has
some subdirectories, for instance you have the following items in it:
foo.c
bar.o
subdir1
subdir2
The command: "echo_g *" will still show what I expect: the 4 items.
The command "echo_b *" (even if I linked against wildarags.obj) will only
list the two files foo.c and bar.o, it will miss the subdirectories.
Note that "dir /b *" will generate the same output as "echo_g.exe".
In the end, IMHO, full consistency/portability across the two compilers,
can't be achieved.
--
gisan
gi...@li...
|