This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Extending vfprintf and family


On Aug 14, 2014, at 12:45 PM, Russ Allbery <eagle@eyrie.org> wrote:

> Philip Prindeville <philipp_subx@redfish-solutions.com> writes:
> 
>> When I was at Cisco in the IOS group, there was a way to register
>> on-the-fly additional format specifiers that *printf() could then
>> leverage; some of the formatting helpers were quite sophisticated,
>> understanding ASN.1 or X.509 certs, etc.  Not sure we need to be that
>> complex, though I wouldn’t reject it if it were offered, either.
> 
> glibc supports exactly this.  See:
> 
> https://www.gnu.org/software/libc/manual/html_node/Customizing-Printf.html#Customizing-Printf


Thanks, that was helpful.  One thing that I don’t think was clear, though, is how the same specifier could handle a uint16_t, uint32_t, or uint64_t value.  For instance, for a ‘Q’ specifier:

%hq
%q
%llq

as examples.  What’s a portable way to retrieve a variable-sized scalar argument?

Thanks,

-Philip


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