![]() |
|
#1
|
||||
|
||||
Re: Conversion: Binary, Decimal, HexI just posted a GID Community blog entitled: Conversion: Binary, Decimal, Hexadecimal.
Quote:
Please let me know what you think. This is an auto-generated message posted by GIDNetwork™ on behalf of the author. __________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#2
|
|||
|
|||
Re: Conversion: Binary, Decimal, HexQuote:
CPP / C++ / C Code:
...why assume? Aren't we aware of sizeof( int ) already? CPP / C++ / C Code:
I can appreciate your interest in keeping the code possibly less confusing to novices, but hardcoding magic values like "33" probably sends the wrong message, doesn't it? I believe that conventional thinking tells us that the only magic numbers in a program should be "0" or "1," which lends nicely to a discussion on conversion! However, I tend to favor 0, 1 and -1...and then it is really hard not to accept "2," particularly for finding evenness/oddness, but then that leads us to 8, 16 and many more...even to the point where we get 33 and, then, really any magic number is okay afterwords, right? In fact, the discipline of using magic numbers is vastly overrated, don't you think? Of course, there are those who would argue that the macro BITS_IN_A_BYTE only marginally "more" portable. :davis: |
Recent GIDBlog
Writing a book by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NFA to DFA conversion | fiddler_808 | C++ Forum | 3 | 02-Jun-2006 13:49 |
| problems typecasting an int to a string | holbrook | C++ Forum | 9 | 07-May-2004 19:59 |
| Decimal to Hex conversion function | machinated | C++ Forum | 0 | 07-May-2004 18:33 |
| Help with binary files (encryption?) | pablowablo | C++ Forum | 6 | 28-Apr-2004 23:47 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The