Archived

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

Estor

Visual Studio 6.0 C/C++ Bug ?

Recommended Posts

Estor    127
Hello Let me introduse problem, this pice of code: char *var_a = "b"; int main () { char *var_b = "a"; var_a[0] = ''A''; var_b[0] = ''B''; return (0); } generates Acces Valiation when compiled with Visual 6.0 C/C++. When I compile it on Borland 5.1 C/C++ it works corect. Prabobly Visual C is puting this pointers in code memory (referenced by [CS] Descryptor). Is there any switch to force alocating data in data memory ? Maybe there is other reason why it is not workin corectly only when compiled with Visual C. "Never use brutal force, always HAMMER !!!"

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
var_a is pointing to a constant string. Can''t modify it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Except that I meant "string literal" instead of "constant string"

Share this post


Link to post
Share on other sites
YodaTheCoda    100
estor i am compeled to note that your spelling is atrosious. how cvan you expect to become a good programer when your gramar skills are so obsenely limited?

Share this post


Link to post
Share on other sites
Estor    127
quote:
Original post by YodaTheCoda
estor i am compeled to note that your spelling is atrosious. how cvan you expect to become a good programer when your gramar skills are so obsenely limited?


Sorry... I understand what im reading, but I have problems with writeing. But all the time I''m learning. 8)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Yoda: Green little aliens backwards talkin does who, whine grammar shouldn''t about

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
He''s gotta be joking, his English is even worse.

Share this post


Link to post
Share on other sites
YodaTheCoda    100
quote:
YodaTheCoda: How good is your Polish, kiwi boy?

why do you aSK ABOUT NMY POLISH DUMASS ITS TOTALY IRELAVENT. I DONT USE POLISH I WEAR SNEEKERS SO THERE! AND IM NOT BIOY DUMASS IM 16 AND NEARLY 17
quote:
Thanks for Help

YOU ARE WELCOME MR ESTOR
quote:
Yoda: Green little aliens backwards talkin does who, whine grammar shouldn''t about

YEAH SO LIKE SHUTUP DUMASS U DONT UNDERSTND WHAT YUR TALKIN ABOUIT
quote:
He''s gotta be joking, his English is even worse.

YEAH WEL AT LEAST I HAVE SOME VARAITY IN THE WORDS I SAY DUMASS

Share this post


Link to post
Share on other sites
darkchrono4    202
If you noticed he''s from Poland. So cut him some slack that his grammer isn''t the best. Not everybody is born with the mastery of English you think you posses.

Share this post


Link to post
Share on other sites
Estor    127
quote:

why do you aSK ABOUT NMY POLISH DUMASS ITS TOTALY IRELAVENT. I DONT USE POLISH I WEAR SNEEKERS SO THERE! AND IM NOT BIOY DUMASS IM 16 AND NEARLY 17


O boy, Kid... Im 25

Say straight... should I not post here any more?

One more thing, You understanded my question dont You.

Share this post


Link to post
Share on other sites
YodaTheCoda    100
quote:
If you noticed he''s from Poland. So cut him some slack that his grammer isn''t the best. Not everybody is born with the mastery of English you think you posses.

yea wel u is dis massiv dong and yuor momma is fat
quote:
O boy, Kid... Im 25

and i am stil more inteligent than you. it must bne becoz you is not eng,lish (like me i am from swindon)
quote:
Say straight... should I not post here any more?

my grabndpa always used to say ''do what yuor heart tels you'' so if u fell yuor heart is teling u to post here then do so
quote:
One more thing, You understanded my question dont You.

yes i did mr estor and i apresiate that yuor gramar has improved so much

Share this post


Link to post
Share on other sites
Zern    138
Wow, I think someone is a bit manic depressed. You should go to a therapist Yoda. Craving for attention and striving towards it by acting immature is a bit serious. Good luck to you in finding the help you need.

(Recent posts show you clearly are acting abnormal for some reason or another, either way, attention/insulting OP, get some help )

Share this post


Link to post
Share on other sites
silvermace    634
fucking hell, yoda you dick, stop making NZ look bad.

dont fink you hav the right to say your more intelligent than him, seeing you sound like you live in a bubble of which, the main ingredient is your ego.

"i dont use polish" -- you fucking idiot, maybe he dosnt use english much??

Yoda can't even spell his fav. profanity "dumass" .. hey, yoda, its DUMBASS you DUMBASS.

NASA's next mission, land a probe on Yoda's ego..
"mission control, the gravity is too strong!!! ... *buzz* ... *buZz* CRASH, BOOOOOM!"

[edited by - silvermace on March 7, 2003 3:46:54 AM]

Share this post


Link to post
Share on other sites
Tyson    122
Well, that took a turn for the worse. All ego battles aside, I can say that I ran into that same thing long ago, and did the research. Turns out that C++ does you a favor by "optimizing" that string making it a literal that is compiled into your object output. Just try to change it and wammo you get a nice exception

declaring it as an array will help that, or simply do this:


  

//instead of this

char* thisIsBorked = "Borked";

//do this:

#include <string>
using std::string;

string thisIsBorked("Borked");
thisIsBorked[3] = ''A'';



//or, if you feel C like that day you can do this:

char* thisIsBorked = new char[6];
strcpy(thisIsBorked,"Borked");
//see if you can call delete [] on this ;)




ahh, fun with your friendly neighborhood C++ compiler







Share this post


Link to post
Share on other sites
mds_79    122
quote:
Original post by YodaTheCoda
estor i am compeled to note that your spelling is atrosious. how cvan you expect to become a good programer when your gramar skills are so obsenely limited?


No Yoda, I am compelled to note that your spelling is atrocious . How can you expect to become a good programmer when your grammar skills are so obscenely limited?

Pretty ironic to me.

"Discipline is never an end itself, only a means to an end." - Robert Fripp


[edited by - mds_79 on March 7, 2003 1:36:57 PM]

Share this post


Link to post
Share on other sites
llyod    122
quote:
Original post by mds_79
[quote]Original post by YodaTheCoda
estor i am compeled to note that your spelling is atrosious. how cvan you expect to become a good programer when your gramar skills are so obsenely limited?


No Yoda, I am compelled to note that your spelling is atrocious . How can you expect to become a good programmer when your grammar skills are so obscenely limited?

Pretty ironic to me.

"Discipline is never an end itself, only a means to an end." - Robert Fripp


[edited by - mds_79 on March 7, 2003 1:36:57 PM]

Hehe... if you find irony in the obviously made-up bad spelling just to make a point then you need to rework your sense of irony.

Share this post


Link to post
Share on other sites
mds_79    122
I did not see it as an obvious case of misspelling. Many other of his posts contain the same level of grammar. What I do see is a demonstration of man's folly.

"Discipline is never an end itself, only a means to an end." - Robert Fripp


[edited by - mds_79 on March 7, 2003 2:31:52 PM]

Share this post


Link to post
Share on other sites