lostgallifreyan wrote:
Joshua Phillips <[email protected]> wrote:
(15/04/2009 13:46)
stricmp or strcasecmp would be provided by the C library. Tcc is only a
compiler - it doesn't include a C library. Therefore, the presence of stricmp
or strcasecmp will be determined by the C library you're using (GNU libc or
MSVCRT or other)
Ok, that makes sense, but if it were only the library that determines what's
there, TCC might compile C++. As it doesn't I assume it's not just the library
that determines this.
(That remark is based in my possibly erroneous assumption that C++ is a kind of
superset of C with a lot more dedicated functions).
In short, doesn't the compiler have to 'understand' what it's compiling?
In short, yes and no. The initial vocabulary (keywords) of a
C compiler is rather small:
char short int long float double enum void
signed unsigned
typedef struct union sizeof
const extern static
if else while do for
continue break goto return switch case default
And some others. The complete list for TCC is in "tcctok.h".
A C++ compiler knows a few additional keywords, like
bool class new delete
...
However the compiler "learns" more words as it reads the include
files and the program text. E.g. with TinyCC it learns "pstrcat"
and "dynarray_add" and "put_ext_sym2" and whatnot.
It learns enough about these words to speak them, but it doesn't
understand their meaning. It understands the meaning of its own
keywords though.
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel