Tuesday, May 23, 2017

Digest for comp.lang.c++@googlegroups.com - 16 updates in 4 topics

woodbrian77@gmail.com: May 23 03:31PM -0700

I would like to encourage compiler developers to backport string_view to
older versions of their compilers. In particular, I'd like to see GCC, Clang
and MSVC do this.
 
String_view is one of the more useful elements of C++ 2017 imo.
Unfortunately, string_view wasn't introduced years ago. I hope compiler
vendors will take a "better late than never" attitude toward string_view
and make it available with their C++ 2011 and 2014 compilers.
 
 
Brian
Ebenezer Enterprises - So far G-d has helped us.
http://webEbenezer.net
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: May 23 06:07PM +0200

Dear people! Folks! Y'all!
 
In some cases, e.g. when using g++'s `code_cvt` implementation, it's
necessary to know the host machine's byte order, a.k.a. endianness, at
compile time.
 
And I'd like that to not have a heavy 3rd party library dependency, such
as Boost.
 
The following is the best I've been able to come up with via simple
googling.
 
But, I don't have access to a lot of computers of different kinds. At
the moment I just have my old laptop. So it would be nice with some
scathing critique and/or constructive improvements, whatever! :)
 
-----------------------------------------------------------------------
#pragma once // Source encoding: utf-8 ∩
// #include <stdlib/workarounds/__BYTE_ORDER__.hpp>
//
// Copyright © 2017 Alf P. Steinbach, distributed under Boost license 1.0.
 
#ifndef __BYTE_ORDER__
# // The values used by the g++ compiler:
# define __ORDER_LITTLE_ENDIAN__ 1234
# define __ORDER_BIG_ENDIAN__ 4321
# define __ORDER_PDP_ENDIAN__ 3412
#
# if defined( _WIN32 )
# define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
# elif defined( __BIG_ENDIAN__ ) || defined( __BIG_ENDIAN ) ||
defined( _BIG_ENDIAN )
# define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
# elif defined( _ARCH_PPC ) || defined( __PPC__ ) || defined( __PPC )
|| defined( PPC ) \
|| defined( __powerpc__ ) || defined( __powerpc ) || defined(
powerpc )
# define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
# else
# error Please define __BYTE_ORDER__, e.g. as __LITTLE_ENDIAN__.
# endif

No comments: