Archived

This topic is now archived and is closed to further replies.

Anybody nows what's wrong with this code?(4 lines)

This topic is 5512 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anybody now what''s wrong with this code? if(Temp == VertexNumber) File.getline(Word,50,'','');//EOL else File.getline(Word,50,'';'');//LAST EOL

Share this post


Link to post
Share on other sites
quote:
Original post by Crispy
shouldn''t you reference Word? as in &Word?


That would not be a reference - that would be the address-of operator.



God puts an apple tree in the middle of the Garden of Eden and says, do what you like guys, oh, but don''t eat the apple. Surprise surprise, they eat it and he leaps out from behind a bush shouting "Gotcha." It wouldn''t have made any difference if they hadn''t eaten it... because if you''re dealing with somebody who has the sort of mentality which likes leaving hats on the pavement with bricks under them you know perfectly well they won''t give up. They''ll get you in the end. -- Douglas Adams

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
That would not be a reference - that would be the address-of operator.

He used "reference" as a verb. I think that it''s quite valid to say that a pointer is referring to an object.

For example, the C++ FAQ Lite uses the term "reference semantics" to designate both pointers and references.

Cédric

Share this post


Link to post
Share on other sites
Thanks people i already fixed the error and it wasn''t that but other lines of code that were directly related to the ones i posted.

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
That would not be a reference - that would be the address-of operator.


The & is also called the reference operator, just like the * is called the dereference operator.

The reason he doesn't have to pass the address of Word is because it's probably the name of an array. It implicitly passes the address of the first element.

[edited by - Matt Calabrese on November 10, 2002 7:30:19 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Matt Calabrese
The & is also called the reference operator

There''s no such thing in C++ called the "reference operator". It''s called the address-of operator.

Share this post


Link to post
Share on other sites
quote:
Original post by SabreMan
There's no such thing in C++ called the "reference operator". It's called the address-of operator.


In C there was nothing referred to as the reference operator, but in C++ the name "reference operator" is commonly used.
It's commonly called the "reference operator" in C++. Look it up.

http://cs.nmhu.edu/personal/curtis/cs1htmlfilesPre8-2001/essentialssec10.htm#refOper

Is one I came across rather quickly in google.

EDIT: Some people even referred to it as the reference operator in C.

This reminds me of thread where you said I was wrong for calling a member function a method. It's just 2 words for the same thing. Maybe originally it was only called the addres-of operator, but that is no longer the case.

[edited by - Matt Calabrese on November 10, 2002 7:40:37 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Matt Calabrese
In C there was nothing referred to as the reference operator, but in C++ the name "reference operator" is commonly used.
It''s commonly called the "reference operator" in C++. Look it up.

I did look it up. I looked in the only source which provides official definitions for C++ terms, but it wasn''t in the C++ Standard.
quote:

http://cs.nmhu.edu/personal/curtis/cs1htmlfilesPre8-2001/essentialssec10.htm#refOper

Is one I came across rather quickly in google.

How about I put up a web page which says "there is nothing in C++ called the reference operator", and have the site indexed with Google so that people can stumble across it. Who''s site do they believe then? The point is, you can find all sorts of crap on the web, and the fact that J. Random Bloke says it is true does not make it true. I say the C++ Standard is the definitive reference of what C++ does and doesn''t have.
quote:

This reminds me of thread where you said I was wrong for calling a member function a method.

Yes, C++ doesn''t define "method" either.

Share this post


Link to post
Share on other sites
*Removed*

A friendly reminder to myself: never reply to anything ever again unless:

1) I have had a good night's sleep;

2) I have tested and compiled any code along with my comments; and

3) I have pulled my head completely out of my ass.

[edited by - RomSteady on November 11, 2002 8:00:44 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Matt Calabrese
Ouch, that was harsh, Oluseyi.

I know, and I''m almost sorry. But people need to learn to check their "facts" before they spout them - particularly at those trying to learn. It''s made much worse by the fact that there''s already been a significant amount of discussion and that the thread starter states that he''s solved the problem, and it had nothing to do with the lines of code indicated.

Look before you leap, or get shot in mid-air.

Share this post


Link to post
Share on other sites
RomSteady are you sure that the semicolon finishes the if statement? i don''t think so. In fact it gives me more than 15 error messages while compiling.

Share this post


Link to post
Share on other sites
quote:
Original post by Oluseyi
people need to learn to check their "facts" before they spout them

I completely agree. There''s a lot of people who suffer from "I believe everything I read" syndrome, and authoritatively stated mistruths are a big problem for those people.

Share this post


Link to post
Share on other sites
quote:
Original post by SabreMan
I completely agree. There''s a lot of people who suffer from "I believe everything I read" syndrome, and authoritatively stated mistruths are a big problem for those people.


That may be the case, but being nasty about it is not justifiable.

Share this post


Link to post
Share on other sites
quote:
Original post by CGameProgrammer
Agreed. What Oluseyi said was not appropriate, unless RomSteady''s original post was harsh or demeaning (I never saw it) but probably it was not.

It wasn''t harsh or demeaning, it was just rather stupid, and Oluseyi took the time to point it out in a harsh manner.

This was RomSteadys post (gathered from Oluseyis use of the quote tag.)
quote:
RomSteady
Easy. You have one too many semicolons in place. The semicolon just prior to the //EOL terminates the if construct. Get rid of that semicolon, and it will work.

And Oluseyis response:
quote:
Do you really believe that, or are you just dense?

Which I don''t think was particularly harsh. Everyone needs to be shot down when they say something stupid. No offense to Rom, we all make mistakes, and you even deleted your post, which helps to prevent the spread of mistruths and marks yours as an honest mistake.

Share this post


Link to post
Share on other sites