delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/12/01/11:00:28

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Thomas8675309 AT yahoo DOT com (Tom)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C/C++ switch statement question
Date: 1 Dec 2003 07:50:36 -0800
Organization: http://groups.google.com
Lines: 14
Message-ID: <7b68d58f.0312010750.7525d94e@posting.google.com>
References: <a8587dd9 DOT 0311300840 DOT 75e9471b AT posting DOT google DOT com> <3FCA24D3 DOT 95AF2A3C AT phekda DOT freeserve DOT co DOT uk> <Pine DOT BSF DOT 4 DOT 58 DOT 0311302017510 DOT 74589 AT server2 DOT shellworld DOT net>
NNTP-Posting-Host: 63.72.148.162
X-Trace: posting.google.com 1070293836 8124 127.0.0.1 (1 Dec 2003 15:50:36 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Mon, 1 Dec 2003 15:50:36 +0000 (UTC)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jude DaShiell wrote:

> First, put an error message in as default: value for switch.  Then you
> might try an integer cast for the string value before switch gets to have
> the variable.

This won't work.  You can't cast a std::string to an int.  You can't
even use this hack with const char*, because two const char* pointers
that point to equivalent values will probably be stored at different
locations.

Best regards,

Tom

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019