%ls and %lc in scanf.c

Artem B. Bityuckiy abityuckiy@yandex.ru
Thu Nov 27 18:17:00 GMT 2003

J. Johnston>The code and the macro references can be removed.

I can do so. Should this macro be removed only from new %ls %lc piece or 
from entire vfscanf.c?

J. Johnston> You might as well be consistent with vfprintf.c.  The usage 
of %ls and %lc might not be used readily for new code for a particular  
J. Johnston> platform, but you can never guess what an application that 
you wish to port is going to do.

Jeff,  sorry, I don't understand what I should do. I agree that It isn't 
know whether %ls and %lc will be needed if MB_CAPABLE is disabled. But 
I'm already align vfprintf.c and vfscanf.c - may be you forget something.

Let's look in vfprintf.c:552 and vfscanf.c:285.  This is the main loop 
that parses 'fmt' string. mb<->wc conversion is aligned here.

Let's look in vfprintf.c lines 747 (%lc) and 913 (%ls) and vscanf.c (+ 
patch I sent) lines 537 (%lc) and 648 (%ls). The code is also aligned - no
MB_CAPABLE checks here. If you want to see it in such places in 
vfscanf.c than we should add it to vfprintf.c too - may be it is 
reasonable since Newlib should be as small as possible. I can do this, 
but, please, clarify this problem.

J. Johnston> The general rule should be: new code should use the Gnu 
Coding standard.  Old code that is brought in will be in whatever 
standard it was written in.  It is best to leave it alone as much as 
possible so that it makes it easier to compare newer versions of the 
source vs the newlib code.  When making modifications, stick with the 
surrounding style ("when in Rome").  If adding a new function in a file, 
then it would be preferable to use the Gnu style but I can live with the 
original style used in the file.

Jeff, it's not a problem, I can align this to GNU format like this:

if (a)

When you clarify the issue with MB_CAPABLE I'll send new patch.

Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

More information about the Newlib mailing list