Click here to Skip to main content
15,921,660 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: code for calculating the point in a surface and minimum distance from the surface to a line segment, which is not in the surface. Pin
mrby12320-May-08 5:44
mrby12320-May-08 5:44 
GeneralRe: code for calculating the point in a surface and minimum distance from the surface to a line segment, which is not in the surface. Pin
Member 419459320-May-08 3:56
Member 419459320-May-08 3:56 
GeneralRe: code for calculating the point in a surface and minimum distance from the surface to a line segment, which is not in the surface. Pin
mrby12320-May-08 5:41
mrby12320-May-08 5:41 
GeneralRe: code for calculating the point in a surface and minimum distance from the surface to a line segment, which is not in the surface. Pin
Member 419459320-May-08 7:01
Member 419459320-May-08 7:01 
GeneralRe: code for calculating the point in a surface and minimum distance from the surface to a line segment, which is not in the surface. Pin
mrby12320-May-08 8:23
mrby12320-May-08 8:23 
GeneralRe: code for calculating the point in a surface and minimum distance from the surface to a line segment, which is not in the surface. Pin
Member 419459320-May-08 11:54
Member 419459320-May-08 11:54 
GeneralRe: code for calculating the point in a surface and minimum distance from the surface to a line segment, which is not in the surface. Pin
Member 419459326-May-08 5:15
Member 419459326-May-08 5:15 
QuestionMemory address differences with MSVC and g++/MinGW Pin
Samjiman19-May-08 11:10
Samjiman19-May-08 11:10 
Hello.

I have this program:

#include < iostream >
using namespace std;

int main() {
char string[] = "This is a string!";
char *pointer = string;

cout << '\n' << string << '\n';
cout << '\n' << *pointer << '\n';
cout << '\n' << &pointer << '\n';

return 0;
}


The version of the program I compiled using MSVC produced different output in 2 seperate runs.

This is a string!     
                      
T                     
                      
001DFAA0                       

This is a string!
                 
T                
                 
001BFBF8         


As can be seen the memory address changes on two separate runs.
This is the output I get from the version of the program compiled with g++/MinGW:

This is a string!
                 
T                
                 
0x22ff1c         


The memory address will be the same no matter how many times this version of the program is run.

So I'm curious, why does the memory address change for the MSVC version, but not the g++/MinGW one?
Is it something to do with MSVC using an optimising compiler?

Thanks. Smile | :)
QuestionRe: Memory address differences with MSVC and g++/MinGW Pin
Maximilien19-May-08 16:13
Maximilien19-May-08 16:13 
GeneralRe: Memory address differences with MSVC and g++/MinGW Pin
Samjiman19-May-08 23:52
Samjiman19-May-08 23:52 
QuestionRe: Memory address differences with MSVC and g++/MinGW Pin
CPallini19-May-08 22:18
mveCPallini19-May-08 22:18 
GeneralRe: Memory address differences with MSVC and g++/MinGW Pin
Samjiman19-May-08 23:54
Samjiman19-May-08 23:54 
QuestionHow to find out Frame Rate and Video Length [modified] Pin
80Eddy19-May-08 10:46
80Eddy19-May-08 10:46 
QuestionSetScrollSizes is cauing pinch. Pin
adityarao3119-May-08 6:16
adityarao3119-May-08 6:16 
AnswerRe: SetScrollSizes is cauing pinch. [modified] Pin
Nelek19-May-08 7:51
protectorNelek19-May-08 7:51 
GeneralRe: SetScrollSizes is cauing pinch. Pin
adityarao3119-May-08 8:15
adityarao3119-May-08 8:15 
QuestionAbout the path Pin
capint19-May-08 5:08
capint19-May-08 5:08 
AnswerRe: About the path Pin
toxcct19-May-08 5:12
toxcct19-May-08 5:12 
GeneralRe: About the path Pin
capint19-May-08 5:30
capint19-May-08 5:30 
GeneralRe: About the path [modified] Pin
toxcct19-May-08 5:34
toxcct19-May-08 5:34 
QuestionHaven't ever heard about escape sequences? Pin
CPallini19-May-08 5:46
mveCPallini19-May-08 5:46 
GeneralRe: About the path Pin
David Crow19-May-08 6:06
David Crow19-May-08 6:06 
JokeRe: About the path Pin
CPallini19-May-08 7:19
mveCPallini19-May-08 7:19 
GeneralRe: About the path Pin
Rajesh R Subramanian19-May-08 20:50
professionalRajesh R Subramanian19-May-08 20:50 
GeneralRe: About the path Pin
CPallini19-May-08 21:55
mveCPallini19-May-08 21:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.