grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC,PATCH] C99 format specifiers for fixed-length integer types


From: Javier Martín
Subject: Re: [RFC,PATCH] C99 format specifiers for fixed-length integer types
Date: Thu, 23 Jul 2009 20:54:58 +0200

Here is a new version which also incorporates the C99 integer constant
macros. To avoid excess verbosity, all macros have now names like Gx,
where x is the standard name. Thus, PRIx64, UINT64_C(a) --> GPRIx64,
GUINT64_C(a).

If the changes seem too invasive and/or the verbosity added is
unbearable, I'd suggest dropping the macros for 8 and 16 bits (and maybe
even 32), which are completely unnecessary under our current target
constraints and most conceivable ones. Thus, one would print an uint16_t
followed by an uint64_t like this (I know, it is a silly example):
  uint16_t seg = 0x40;
  uint64_t off = GUINT64_C(0x13);
  grub_printf("int13 slot @ %04x:%016"GPRIx64", seg, off);

However, as I already said, orthogonality has a small but not negligible
importance, because it makes the world (seem) less weird. GUINT16_C and
GPRIx16 (for example) are not that long to type, particularly when 16bit
values are not that frequent, and it might help recognizability (aka
"what type is this variable?") for those without an IDE.

-- 
-- Lazy, Oblivious, Recurrent Disaster -- Habbit

Attachment: c99intmacros.patch
Description: Text Data

Attachment: signature.asc
Description: Esto es una parte de mensaje firmado digitalmente


reply via email to

[Prev in Thread] Current Thread [Next in Thread]