TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: BRIAN WOOD
date: 1998-01-21 18:56:00
subject: multichar constant

I found a quick fix for now, but I'm still curious about why an
expression like '/a' could be evaluated two different ways on the same
machine, using different compilers.
By fooling around and doing stuff like this...
cout << "Expression /a in hex = " << hex << '/a' << endl;
and checking the output, I've realized that Microsoft v 8.00 is 'seeing'
this two char constant right-to-left, while Borland sees it
left-to-right.  Adding a case 'a/': fixes the problem for now.
   while(--argc && **argv++) {
      cout << "command-line switch = ";
      switch(*(int*) *argv) {
         case '/a':  case 'a/':
            cout << "/a" << endl;
         break;
         default:
            cout << *argv << " (unknown)" << endl;
         break;
      }
   }
I suppose the problem is "undefined", "non-portable" solutions
implemented by each vendor on how to handle multi-byte character
constants??  Is there a simple, portable way to do the above?
L8r,
bw
... If all goes well, you've overlooked something!
--- Blue Wave/DOS v2.20
---------------
* Origin: River Canyon Rd. BBS Chattanooga, Tn (1:362/627)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.