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

Re: [libvirt] [PATCH 2/9] s/long long/size_t/ for file line numbers in logging code



On Thu, Sep 27, 2012 at 01:05:55PM -0600, Eric Blake wrote:
> On 09/27/2012 10:44 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange redhat com>
> > 
> > The __LINE__ macro value is specified to fit in the size_t
> 
> Not quite accurate.  C99 merely says:
> 
> 6.10.4 p3:
> ... a line number as specified by the digit sequence (interpreted as
> a decimal integer). The digit sequence shall not specify zero, nor a
> number greater than
> 2147483647.
> 
> 6.10.8 p1:
> _ _LINE_ _ The presumed line number (within the current source file) of
> the current
> source line (an integer constant).
> 
> So in fact, __LINE__ is guaranteed to fit within a 32-bit signed
> integer, and you could s/size_t/int/ with no loss in functionality since
> we don't port to 16-bit 'int' platforms.  That said, I'm not too fussed
> with things; size_t is definitely better than 'long long', so I'm okay
> even if you don't further relax to 'int'.

Based on discussion in the later patches, I'm happy to change this
to just 'int'.  Still surprised it wasn't actually size_t in the
standard, but oh well.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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