Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualMartins Mozeiko

Posted 14 February 2012 - 05:22 PM

What I described should work using Visual C++ and g++ as well. I don't know about the embedded systems, so thanks for clarifying.


Not for me...
c:\test>cat a.cpp
#include <stdio.h>
int main()
{
  int* ptr;
  printf("%p\n", ptr);
}
c:\test>g++ a.cpp

c:\test>a.exe
7EFDE000

c:\test>cl a.cpp /nologo
a.cpp
c:\test\a.cpp(5) : warning C4700: uninitialized local variable 'ptr' used

c:\test>a.exe
00000001

c:\test>

#3Martins Mozeiko

Posted 14 February 2012 - 05:22 PM

What I described should work using Visual C++ and g++ as well. I don't know about the embedded systems, so thanks for clarifying.


Not for me...
c:\test>cat a.cpp
#include <stdio.h>
int main()
{
  int* ptr;
  printf("%p\n", ptr);
}
c:\test>g++ a.cpp

c:\test>a.exe
7EFDE000


c:\test>cl a.cpp /nologo
a.cpp
c:\test\a.cpp(5) : warning C4700: uninitialized local variable 'ptr' used

c:\test>a.exe
00000001

c:\test>

#2Martins Mozeiko

Posted 14 February 2012 - 05:22 PM

What I described should work using Visual C++ and g++ as well. I don't know about the embedded systems, so thanks for clarifying.


Not for me...
c:\test>cat a.cpp
#include <stdio.h>
int main()
{
  int* ptr;
  printf("%p\n", ptr);
}
c:\test>g++ a.cpp

c:\test>a.exe
7EFDE000

c:\test>cl a.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

a.cpp
c:\test\a.cpp(5) : warning C4700: uninitialized local variable 'ptr' used
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:a.exe
a.obj

c:\test>a.exe
00000001

c:\test>

#1Martins Mozeiko

Posted 14 February 2012 - 05:22 PM

What I described should work using Visual C++ and g++ as well. I don't know about the embedded systems, so thanks for clarifying.


Not for me...
c:\test>cat a.cpp
#include <stdio.h>
int main()
{
  int* ptr;
  printf("%p\n", ptr);
}
c:\test>g++ a.cpp

c:\test>a.exe
[b]7EFDE000[/b]

c:\test>cl a.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

a.cpp
c:\test\a.cpp(5) : warning C4700: uninitialized local variable 'ptr' used
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:a.exe
a.obj

c:\test>a.exe
[b]00000001[/b]

c:\test>

PARTNERS