[cfe-commits] [patch] Conditionalize use of 'long long' for libc++

Howard Hinnant hhinnant at apple.com
Mon Nov 26 08:59:38 PST 2012


On Nov 25, 2012, at 12:24 PM, Dimitry Andric <dimitry at andric.com> wrote:

> Hi,
> 
> When using libc++ headers on FreeBSD, in combination with -std=c++98,
> -ansi or -std=c++03, the long long type is not supported.  So in this
> case, several functions and types, like lldiv_t, strtoll(), are not
> declared.
> 
> The attached patch conditionalizes those types and functions for libc++,
> using a _LIBCPP_HAS_NO_LONG_LONG define.  This can easily be extended
> to other operating systems.
> 
> -Dimitry
> <libcxx-long-long-1.diff>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Thanks for the patch Dimitry.

long long is used extensively throughout the libc++ headers.  I'm counting over 200 uses (just a quick search which also picks up comments).  The reason long long isn't already guarded is because libc++ wasn't meant to serve as a C++98/03 implementation.

I'm wondering if your patch actually expands the usability of libc++ on FreeBSD.  It only guards 2 of the 14 or so headers that use long long.  I'm hesitant both to put in a partial solution, and also to clutter the library by guarding all uses.

Can you clarify what differentiates <cstdlib> and <cwchar> from all of the other headers that use long long?

Thanks,
Howard




More information about the cfe-commits mailing list