[RFC]: designing customizable format attributes

Joseph S. Myers joseph@codesourcery.com
Sat Jul 9 16:50:00 GMT 2005


On Sat, 9 Jul 2005, Kai Henningsen wrote:

> It would be nice if the design at least was not totally incompatible with  
> checking format strings in Objective C Foundation code.

The fact that there are so many such individual feature people might want 
for their particular formats, each simple but together adding up to a lot 
of complexity, illustrates the problems with doing something with a 
manageable syntax without then finding most users want more and each wants 
something different more.

That's no doubt why many people want general mechanisms for plugging in 
code - in pre-existing languages rather than little ones designed just for 
checking or transformations - to do arbitrary checks or transformations on 
programs.  Which for various reasons we are unlikely to get in GCC, so 
people have external checking projects not based on GCC.  Which probably 
don't support Objective-C, though such support could be added.

> 4. Not really related to this, but I thought I should point out MS' gift  
> to format specs here - %I64 (that's capital i, not lower L) (otherwise  
> known as %ll). There's no idea so bad someone won't implement it.

Which has been discussed (with reference to the question of whether 
"printf" is a constant set of formats, including glibc's 'I' flag which 
conflicts with MS, or describes particular target library functions).  
It's one part of the case for extensibility, but would need some way to 
specify "like printf, but minus the 'I' flag and with length specifiers 
parsed in a different way which allows I64".  Add lots of special cases 
like that and you get a mess with datastructures forced to stay fixed.  
Provide a Turing-complete system where you can cut out fragments of the 
program for printf formats and insert your own from your source code and 
you get something slightly less messy but if the structures aren't forced 
to stay fixed how the program for printf works probably is.  All making 
the case for instead making it easy for people to distribute their own 
patches to GCC and to download and build and install GCC with given 
checking patches applied and with bug reporting instructions automatically 
changed to point to the patch creator.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc-patches mailing list