Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 29th, 2006, 2:19 PM   #11
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Yeah sorry Jayme, I edited my post, but it's because of the string class operator==.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 29th, 2006, 2:21 PM   #12
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
Gotta love the string class.
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Mar 29th, 2006, 3:10 PM   #13
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
So this means you can't do something like this?:
I could have sworn my original post mentioned arrays, not the string class...I should pay more attention.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 29th, 2006, 5:46 PM   #14
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 855
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
I found it confusing that you named the variable myString rather than myCharArray or such.
titaniumdecoy is offline   Reply With Quote
Old Mar 29th, 2006, 7:10 PM   #15
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
The term, 'string', predates C++ AND C. So do the words, 'vector', 'reference', etc. Some of us are older than others, even though our memory now sucks.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 30th, 2006, 2:35 AM   #16
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by DaWei
The term, 'string', predates C++ AND C. So do the words, 'vector', 'reference', etc. Some of us are older than others, even though our memory now sucks.
Yeah the term "string" predates C++ and C in Dutch also, it's an English word, but in Dutch it means "thong". So if I talk to a programmer on the streets and talk about strings, people look strange at me.

We have another word like that, "beamer", which is also an English word but it's non-existing in the English language, the English word is "(video) projector".
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 30th, 2006, 5:14 AM   #17
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
Quote:
Originally Posted by nnxion
Yeah the term "string" predates C++ and C in Dutch also, it's an English word, but in Dutch it means "thong". So if I talk to a programmer on the streets and talk about strings, people look strange at me.

We have another word like that, "beamer", which is also an English word but it's non-existing in the English language, the English word is "(video) projector".
Don't go to Sweden and ask for a glass of beer, unless you're confident the person you're asking is fluent in english. The Swedish word that sounds like "beer" actually means "vegetable oil" or something similar.

The treatment of strings and arrays in C (and hence C++) is a little strange. Novices tend to think of the "Hello" as a string (or if they are pedantic, as a string literal) but, to the compiler, it is an array of 6 (yes, I mean 6) characters. So you can only manipulate it (assign to it if it's variable, compare it with other string literals, etc) using operations that work on arrays. Functions like strcpy() and strcmp() do that (and are normally the things the programmer needs to use), while operators like = or == compare pointers rather than arrays.

And, to confuse things further, the C++ standard library includes a string type, which is technically a C++ class that encapsulates an array of characters.
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:13 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC