Welcome, Guest. Please login or register.

Author Topic: multi-character character constants in C++  (Read 2276 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: multi-character character constants in C++
« Reply #14 from previous page: April 06, 2003, 11:23:01 AM »
he he,

Maybe I'll waste some time today and go backwards through my posts to obliterate the broken spaces :-D

-edit-

One down...X to go :-D
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: multi-character character constants in C++
« Reply #15 on: April 06, 2003, 11:43:06 AM »
Quote

Sidewinder wrote:
You see, the problem is that it's not my code.  It's part of the POVRay ray tracing package which is supposed to be portable code.  There are litterally thousands of occurences of this error.  I guess I'll just ignore it and see what happens.


If you can be bothered, you could try an explicit cast to long - eg

JOHN_NAME = (long)'john'

That's still not particularly portable but it might just shut the compiler up...

-edit-

Just noticed: long john :lol:
int p; // A
 

Offline Vincent

  • Hero Member
  • *****
  • Join Date: Dec 2002
  • Posts: 3895
    • Show only replies by Vincent
Re: multi-character character constants in C++
« Reply #16 on: April 06, 2003, 02:36:53 PM »
Quote

elendil wrote:

Your last code example looked nice. I am using opera. I agree indentation is a must, but it REALLY makes code hard to read when there is a (let me see íf I can type it without it being interpreted) & n b s p in front of it all - with no space to the first character, mind you :) a variable v looks very weird being called & nbspv, for example.


I'm using Opera 7.01 here and all of Karlos' code posts look fine here.  Strange that it's different for you.
Xbox360
"Oh no. Everytime you turn up something monumental and terrible happens.
I don\'t think I have the stomach for it." - Raziel
 

Offline mdwh2

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 565
    • Show only replies by mdwh2
Re: multi-character character constants in C++
« Reply #17 on: April 06, 2003, 03:10:45 PM »
Quote

Vincent wrote:
I'm using Opera 7.01 here and all of Karlos' code posts look fine here.  Strange that it's different for you.

I think he's edited them now :) (I'm using Opera 7.01 and saw the problem, earlier).
 

Offline Vincent

  • Hero Member
  • *****
  • Join Date: Dec 2002
  • Posts: 3895
    • Show only replies by Vincent
Re: multi-character character constants in C++
« Reply #18 on: April 06, 2003, 03:33:52 PM »
Quote

mdwh2 wrote:
I think he's edited them now :) (I'm using Opera 7.01 and saw the problem, earlier).


I was reading this post yesterday, before the editing, and everything looked ok in Opera 7.01 then.  I was actually speaking to Karlos on ICQ when elendil posted asking about the " "s.  He checked from IE5, and I looked from Opera 7.01 and Netscape.  Neither of us could see the "s in Karlos' post.

I should have mentioned that before, sorry.
Xbox360
"Oh no. Everytime you turn up something monumental and terrible happens.
I don\'t think I have the stomach for it." - Raziel
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: multi-character character constants in C++
« Reply #19 on: April 06, 2003, 03:36:30 PM »
Quote

Vincent wrote:
I was reading this post yesterday, before the editing, and everything looked ok in Opera 7.01 then.  I was actually speaking to Karlos on ICQ when elendil posted asking about the " "s.  


:lol: Was he ever! What time did you hit the sack, mate?
int p; // A
 

Offline SidewinderTopic starter

  • Full Member
  • ***
  • Join Date: Mar 2002
  • Posts: 241
    • Show only replies by Sidewinder
    • http://www.liquido2.com
Re: multi-character character constants in C++
« Reply #20 on: April 06, 2003, 04:58:55 PM »
Quote

If you can be bothered, you could try an explicit cast to long - eg

JOHN_NAME = (long)'john'

That's still not particularly portable but it might just shut the compiler up...

-edit-

Just noticed: long john


"long john" Very nice!  Well I tried the cast, but no joy.  It seems that the compiler isn't complaining about the assignment but rather about the fact that there is more than one character between the single quotes.  The code compiles ok however, just with about 3-4 thousand warnings.  :-)
Sidewinder
 

Offline Vincent

  • Hero Member
  • *****
  • Join Date: Dec 2002
  • Posts: 3895
    • Show only replies by Vincent
Re: multi-character character constants in C++
« Reply #21 on: April 07, 2003, 12:06:45 AM »
Quote

Karlos wrote:
Quote

Vincent wrote:
I was reading this post yesterday, before the editing, and everything looked ok in Opera 7.01 then.  I was actually speaking to Karlos on ICQ when elendil posted asking about the " "s.  


:lol: Was he ever! What time did you hit the sack, mate?


:lol:
I was too hungry to just go to bed, so I had to make something to eat. :-D

My brain was really fried by the time I got to bed, I think it was about 4:30, but I don't know for sure. :-)
Xbox360
"Oh no. Everytime you turn up something monumental and terrible happens.
I don\'t think I have the stomach for it." - Raziel