This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC]: designing customizable format attributes (Kaveh R. Ghazi)  wrote on 08.07.05 in <>:

> I think it's agreed that being able to specify the format attribute's
> properties in the source code rather than hardcoding it into the
> compiler is better. :-) So I'd like to take a stab at doing this.  If
> we can come up with a good design, implementing it shouldn't be too
> hard.

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

For a short explanation for people not familiar with this:

1. The format strings themselves are NSString objects, not naked character  
strings. If they're literals, they're of the builtin string object type  
(NXString or similar).

2. The functions in question are objc methods, such as [NSString  
stringWithFormat: @"...", parm1, parm2, parm3] or [somestring  
stringByAppendingFormat: ...] ... there are also objc equivalents of  
strftime that I don't remember exactly right now and am too lazy to look  
up for this mail. Obviously, one would need to extend the parser to allow  
attributes for these to make anything work; I hope the new parser makes  
that reasonably simple.

3. The only unusual spec I'm aware of is %@ for objc objects; I expect any  
architecture like you propose would have no problems whatsoever with that.

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.

So what I'm mostly saying here is that there should be some way to make  
this work for an unusual kind of function and string as a format. I have  
no idea if that is hard or trivial. However, format checking for  
Foundation strings is certainly something whose absence is hurting quite a  

I once tried to do some macro wizardry to get at least some cases checked,  
but dropped it when I realized %@ wasn't going to work; that specifier is  
awfully common in objc code.

MfG Kai

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]