[cfe-dev] [PATCH] Let __attribute__((format(…))) accept OFStrings

David Chisnall David.Chisnall at cl.cam.ac.uk
Wed Nov 27 09:16:27 PST 2013


On 27 Nov 2013, at 16:50, Jonathan Schleifer <js at webkeks.org> wrote:

> Am 27.11.2013 um 17:47 schrieb David Chisnall <David.Chisnall at cl.cam.ac.uk>:
> 
>> This seems the wrong way around.  You'd want to define a per-method thing, not a per-receiver thing, so we'd just want to define a new printf flavour and add things to it.  
> 
> Uhm, this is exactly what I meant: Add a new printf flavour, but let it accept an OFString* (or subclass) instead of a const char*. Or how exactly are we misunderstanding each other here?

You can only have one format of constant string per compilation unit, so this doesn't seem important.  The type of the constant string argument is something that is defined by the parameter type, it doesn't need to be part of the printf extension format.  

Instead, you want to be able to define printf-like method sets, and then attach these to methods as you currently do with the standard printf-like things.

David





More information about the cfe-dev mailing list