Re: glib bug on windows?



Hubert =?ISO-8859-2?Q?Soko=B3owski?= writes:
%% works fine, thanks. but it is strange that \% works on linux and on
windows it doesn't.

What's so strange with that? The standard way to get a '%' through
printf() and friends has always been to double it. \% isn't even
mentioned in the man page for printf() on Linux.

\% is doubly confusing as the escape sequences starting with \ used in
string literals are interpreted already by the compiler. As far as I
know using the sequence \% in a string might invoke undefined
behaviour in the compiler. Apparently gcc chooses to store both the \
and % in the string literal as such (compare to for instance \n which
stores just one char in the string literal), so they get passed on to
printf.

--tml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]