Sujet : Re: tcc - first impression. Was: Baby X is bor nagain
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 02. Jul 2024, 09:54:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240702115448.00002025@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Mon, 01 Jul 2024 14:48:30 -0700
Keith Thompson <Keith.S.Thompson+
u@gmail.com> wrote:
Michael S <already5chosen@yahoo.com> writes:
[...]
I tried tcc too.
>
1. It is easy to download. It does not need installation apart from
unzip.
So you're on Windows.
[...]
4. In this particular project I encountered few inconvenient
incompatibilities:
4.1. no support for %zd and %zu. May be, Linux version is better in
that regard?
%zd and %zu are supported by the runtime library, not by the compiler.
It's likely that tcc is configured to use something like msvcrt.dll,
which typically doesn't support C99 features.
>
I think, bart said that tcc is self-contained. I interpreted is like
containing C RTL. Obviously, my interpretation of bart's statement was
wrong and in reality tcc relies on external RTL.
Microsoft's DLLs support majority of C99 format specifiers for quite
long time. I am certain that %zd is supported by DLL supplied with
VS2017, but would guess that it was supported since VS2015, when they
shipped VCRUNTIME140.DLL for the first time. So either 7 or 9 years.
It would be nice if tcc was able to use this newer more compatible,
while sometimes slower, stuff.
4.2. Code like below does not compile. I don't know whether it is
legal 'C' or not,
but gcc, clang and MSVC compilers accept it o.k.
label:int bar;
That's a syntax error in versions of C up to and including C17. C23
allows labels on declarations.
(Incidentally, the N3220 draft says that labels can be applied to
either statements or declarations, but the grammar doesn't seem to
reflect that.)
Now I paid attention that my statement above is incorrect: clang does
*not* accept it.
gcc accepts it, for all supported standards, but with -Wpedantic
it issues the warning for all standards except c2x.
MSVC (17 and 19, but not 13) accepts it and issues no warning even with
maximal warning level.
clang and tcc are right. I find no advantages in this sort of rightness.
4.3. c11/c17 things that are supported even by MSVC, which is
generally does not claim full C11 support:
_Alignof()
>
It's close to advertised, i.e. it is not C17, but has few features
of C17.
tcc is not advertised to support C17. According to
<https://bellard.org/tcc/>, "TCC is heading torward full ISOC99
compliance."
>
I didn't say that they advertise C17. However in practice they do
support few C11/C17 features. So why not _Alignof() ?
Considering that tcc already supports old Gnu __alignof__ extension,
adding support for _Alignof() would be very easy for them.