Re: [boost] Interest in a binary_int template for binary literals?

Greetings, I'm back from vacation. I have a note and a question regarding the binary_int template. 1. I've compiled the binary_int template with Microsoft Visual Studio.NET version 7.0. It gets unhappy when the most significant bit is set in a 32-bit binary word. The compiler reports: warning C4307: '*' : integral constant overflow along with a bunch of other stuff about the template instantiation. It seems to be only a warning however, since the executable is still produced and runs properly. I tried a couple of things in the enum definition to try and convince the compiler to use an unsigned int for the computation, but to no avail. I couldn't figure out a way to get rid of the warning. 2. Pavel Vozenilek thinks that the names binary_nibble and binary_int could be improved on. Pavel suggests the names 'nibble' and 'bits', noting that the term 'binary' has too many connotations in C++. At any rate, what do folks think would be good names for these two templates? Thanks. Scott Schurr

From: Scott Schurr <scott_schurr@credence.com>
2. Pavel Vozenilek thinks that the names binary_nibble and binary_int could be improved on. Pavel suggests the names 'nibble' and 'bits', noting that the term 'binary' has too many connotations in C++.
At any rate, what do folks think would be good names for these two templates?
If not "binary" then what, "base2?" IIUC, these templates produce numeric values from a binary representation. Thus, the result is nothing more than a number and its coming from binary digits is no longer important, so "binary" doesn't need to be part of their name. Maybe putting them in a "binary" namespace would help? namespace binary { template ... class number; template ... class nibble; } If you want to support signed and unsigned, then you'll have to skirt around keywords with something like: signed_ and unsigned_. (The same problem arises with your original "binary_int:" it can't be binary::int.) -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
participants (2)
-
Rob Stewart
-
Scott Schurr