This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: WCHAR_MAX question
I actually have a newer compiler: 3.4.0. I could find no sign of the
--with-short-wchar configuration option in my sources.
This really should be done by the compiler. The macro has to be a
constant so it cannot use sizeof() or make a function call (ala errno).
Now, an end-user can always specify the -fshort-wchar option on a
compilation. As you can see, this means that the macro should be
dynamically defined by the compiler. The newest gcc compiler has
managed to do this right.
Ok, thanks for help.
Even without the -fshort-wchar problem, calculating at configuration
time is going to be inaccurate. For a cross-target, an execution test
would be required, but we can't do that when we are in the stages of
building the C library. I guess we could check for the configuration
option and set a flag in newlib.h to handle the case you have mentioned.
Just to note, newer autoconf is able to determine constants like
sizeof(wchar_t) without running test on target board!
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.