Treatment of C/C++ compiler

The C/C++ compiler is how to deal with this statement:
char *s;
s="good";
Variable space is the compiler automatically identify it?

Started by Winfred at February 03, 2016 - 12:03 AM

This method is a problem, should be:
char* s = "good";

Posted by Dick at February 15, 2016 - 12:42 AM

If, you are using C++, please.
 const char* s = "good";

Posted by Mandy at February 20, 2016 - 1:30 AM

No, compile, and can output.

Posted by Winfred at November 12, 2016 - 4:02 PM

Seeing is not necessarily believing, have a look of the proposed system C Primer Plus .

Posted by Dick at November 13, 2016 - 4:47 PM

This I was very interested in, what is the problem? Could I trouble you to explain it?

Posted by Mandy at November 22, 2016 - 5:47 PM

The other is if you define a variable and initialize with "good" in or before"good";

Posted by Yvonne at November 26, 2016 - 6:34 PM

How to prove? I think what you said is not right, not the standard defined behavior.

Posted by Mandy at December 08, 2016 - 7:30 PM

I feel no problem! There is nothing wrong with you?

Posted by Dempsey at December 17, 2016 - 8:10 PM

Read the book has said "C++ PRIMER PLUS" is like VC6 I tried so you can try

Posted by Yvonne at December 26, 2016 - 8:48 PM

The compiler is allowed, but not required, to merge string literals.
Come up with a compiler that thing, is not convincing, especially VC6.
You said VC6 can make computer explosion, I have no doubt whatsoever.

Posted by Mandy at December 28, 2016 - 9:26 PM

The principle, the DOS command, assembly language, C language computer (not including C++), code writing, data structure, compiler, operating system, computer network, database principle, regular expressions, other languages (including C++), architecture...

To learn the programming advice:
Eye hand over a thousand times better!
Books to read than a thousand hand knock!
Hand knock thousands of lines as single line!
The Dan Buyuan code thousand lines as single step corresponding assembly line!

When debugging VC according to Alt+8, Alt+7, Alt+6 and Alt+5, open the window, the window assembly stack, memory window and register window at each sentence corresponds to C assembly, single step and observe the corresponding stack, memory and register change, so again not what all understand it.
For VC, after the so-called 'debugging' is connected to the compiler through, press F10 or F11 key step a step at a time later, or in a line according to the F9 set breakpoints by F5 execution time stopped at the breakpoint.
(Turbo C or Borland C Turbo Debugger debugging, Linux or Unix using GDB test, see every sentence corresponds to C assembly and step through the observation of the corresponding memory and register changes. )

Posted by Vanessa at December 29, 2016 - 9:33 PM

#pragma comment(linker,"/SECTION:.rdata,RW")
//This sentence can make constant region can be written, the consequences!

Posted by Vanessa at January 01, 2017 - 11:24 PM

I compiled can also pass on VS2010.

Posted by Winfred at January 05, 2017 - 11:37 PM

Well, thank you. I just think the compiler handles, when declaring a pointer variable s, how the compiler handles the statement? Is how to develop the required memory.

Posted by Winfred at January 08, 2017 - 9:51 PM

Thank you. In compliance with your teachings.

Posted by Winfred at January 12, 2017 - 10:35 PM