Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #176 > unrolled thread

Re: An hexadecimal digits group separator for long 64bit addresses

Started byMagnus Fromreide <cscpp@magfr.users.lysator.liu.se>
First post2011-06-23 19:32 -0600
Last post2011-06-25 08:50 -0600
Articles 4 — 3 participants

Back to article view | Back to comp.std.c++

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: An hexadecimal digits group separator for long 64bit addresses Magnus Fromreide <cscpp@magfr.users.lysator.liu.se> - 2011-06-23 19:32 -0600
    Re: An hexadecimal digits group separator for long 64bit addresses ThosRTanner <ttanner2@bloomberg.net> - 2011-06-25 08:51 -0600
      Re: An hexadecimal digits group separator for long 64bit addresses Miles Bader <miles@gnu.org> - 2011-06-26 20:09 -0600
    Re: An hexadecimal digits group separator for long 64bit addresses Miles Bader <miles@gnu.org> - 2011-06-25 08:50 -0600

#176 — Re: An hexadecimal digits group separator for long 64bit addresses

FromMagnus Fromreide <cscpp@magfr.users.lysator.liu.se>
Date2011-06-23 19:32 -0600
SubjectRe: An hexadecimal digits group separator for long 64bit addresses
Message-ID<1308849997.2080.3.camel@sara>
On Thu, 2011-06-16 at 12:07 -0600, Yaniv Abraham wrote:
> Hello Everyone,
> As 64bit word processors become more and more widespread, some of
> which also see embedded applications (such as the NetLogic XLP800-
> family of system processors) the current syntax in C and C++ for
> hexadecimal numbers notation (and thus their notation of encoding
> addresses), a long string of hexadecimal digits with the 0x prefix,
> become IMHO too long making it hard to interpret and grasp quickly.
> Is there a proposal to `enhance' this notation in the next C/C++
> standard to make hexadecimal numbers easier to type and understand?
> C/C++ can adopt the notation that technical hardware manuals are using
> for a long time of using the `_' character to separate between 4 or 8
> nibbles (4bit) sequences of digits (e.g. instead of reading
> 0xFFFF58AE3BBE33AC I think it will be much easier to read
> 0xFFFF58AE_3BBE33AC or even 0xFFFF_58AE_3BBE_33AC).
> What do you think? Anyone?

I think you are to late.
This would clash with user-defined literals, wouldn't it?

int operator "" _1234 (int n) { return 17; }

0x12cd_1234;

/MF



--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

[toc] | [next] | [standalone]


#177

FromThosRTanner <ttanner2@bloomberg.net>
Date2011-06-25 08:51 -0600
Message-ID<a60defb1-0c9f-41b0-a7b2-ea90cce7af89@fj19g2000vbb.googlegroups.com>
In reply to#176
On Jun 24, 2:32 am, Magnus Fromreide
<cs...@magfr.users.lysator.liu.se> wrote:
> On Thu, 2011-06-16 at 12:07 -0600, Yaniv Abraham wrote:
> > Hello Everyone,
> > As 64bit word processors become more and more widespread, some of
> > which also see embedded applications (such as the NetLogic XLP800-
> > family of system processors) the current syntax in C and C++ for
> > hexadecimal numbers notation (and thus their notation of encoding
> > addresses), a long string of hexadecimal digits with the 0x prefix,
> > become IMHO too long making it hard to interpret and grasp quickly.
> > Is there a proposal to `enhance' this notation in the next C/C++
> > standard to make hexadecimal numbers easier to type and understand?
> > C/C++ can adopt the notation that technical hardware manuals are using
> > for a long time of using the `_' character to separate between 4 or 8
> > nibbles (4bit) sequences of digits (e.g. instead of reading
> > 0xFFFF58AE3BBE33AC I think it will be much easier to read
> > 0xFFFF58AE_3BBE33AC or even 0xFFFF_58AE_3BBE_33AC).
> > What do you think? Anyone?
>
> I think you are to late.
> This would clash with user-defined literals, wouldn't it?
>
> int operator "" _1234 (int n) { return 17; }
>
> 0x12cd_1234;
>

I'd reserve literals beginning with _ for system defined use (in much
the same way that it's considered bad style to have anything with a
name beginning with _, although the standard only refers to _ followed
by upper case letter).

Especially as a readable numeric separator is far more useful than a
user defined literal (I've frequently missed the former, only rarely
the latter).


-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

[toc] | [prev] | [next] | [standalone]


#182

FromMiles Bader <miles@gnu.org>
Date2011-06-26 20:09 -0600
Message-ID<87aad5mj90.fsf@catnip.gol.com>
In reply to#177
ThosRTanner <ttanner2@bloomberg.net> writes:
>> This would clash with user-defined literals, wouldn't it?
>>
>> int operator "" _1234 (int n) { return 17; }
>>
>> 0x12cd_1234;
>
> I'd reserve literals beginning with _ for system defined use (in much
> the same way that it's considered bad style to have anything with a
> name beginning with _, although the standard only refers to _ followed
> by upper case letter).

I disagree.

Literals starting with "_" should be available for users, as they are
much more readable, and feel more natural for longer names (more than
one or two characters).  That's the reason, presumably, that many
examples one sees of user-defined literals have names starting with
"_"....

It's a separate namespace, so there's no conflict with traditional
identifiers (and "bad style" is irrelevant).

-Miles

--
"Most attacks seem to take place at night, during a rainstorm, uphill,
 where four map sheets join."   -- Anon. British Officer in WW I


[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

[toc] | [prev] | [next] | [standalone]


#178

FromMiles Bader <miles@gnu.org>
Date2011-06-25 08:50 -0600
Message-ID<buo1uyju4x0.fsf@dhlpc061.dev.necel.com>
In reply to#176
Magnus Fromreide <cscpp@magfr.users.lysator.liu.se> writes:
>> 0xFFFF58AE3BBE33AC I think it will be much easier to read
>> 0xFFFF58AE_3BBE33AC or even 0xFFFF_58AE_3BBE_33AC).
>
> I think you are to late.
> This would clash with user-defined literals, wouldn't it?
>
> int operator "" _1234 (int n) { return 17; }
>
> 0x12cd_1234;

Hmm, how about using apostrophe ('):

0x12cd'1234

1'234'567

Maybe a little bit less pretty than _, but still pretty good I think...

-miles

-- 
Yo mama's so fat when she gets on an elevator it HAS to go down.


[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.std.c++


csiph-web