Adam Rosenfield

United States

adamrosenfield.com

Age: 28

Software engineer from Cambridge, MA

17h
awarded Nice Answer
21h
comment Linking with GCC and x86 ASM in x64 Environment
From the looks of this mailing list post, I think you need to be using the 32-bit Cygwin to compile a 32-bit x86 executable.
1d
awarded Guru
1d
comment can't create threads suspended using windows.h
Obligatory: A function pointer cast is a bug waiting to happen.
1d
comment Does LLDB change the address of environment variables of C programs?
You can disable ASLR in executables you build yourself by passing the -no_pie option to the linker (or equivalently by passing -Wl,-no_pie to the compiler, which then passes that through to the linker), although that's generally not recommended except as an exercise for experimenting. Of course, if you're trying to exploit an executable compiled with ASLR, then it's much more difficult to get around.
2d
revised I'd like to know what happens when a function create objects in it
added 3 characters in body
2d
comment Does LLDB change the address of environment variables of C programs?
The difference between (2) and (1) of 0x37aa023 is almost certainly due to address space layout randomization­.
Aug
19
comment C++ and PHP vs C# and Java - unequal results
@Christian: Actually, the behavior on the whole is still undefined (not unspecified) in both the function call and comma operator cases, because C++03 §5/4 says "Between the previous and next sequence point a scalar object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored. The requirements of this paragraph shall be met for each allowable ordering of the subexpressions of a full expression; otherwise the behavior is undefined." (emphasis added).
Aug
19
comment callback with void pointer argument produce warning
A function pointer cast is a bug waiting to happen. Don't do it. It's much better to declare your function as void ProcessMsgAction0(void *msg) {} and internally cast from void* to action0_t*.
Aug
19
answered Segmentation fault (core dumped) error for selection sort pointer char array
Aug
19
comment Segmentation fault (core dumped) error for selection sort pointer char array
+1 for writing a short, self-contained, correct compilable example
Aug
18
awarded Popular Question
Aug
18
comment C++ and PHP vs C# and Java - unequal results
How is the C++ comma operator example any different from the function call example? There is a sequence point after the evaluation of the first operand of the comma operator (C++03 §1.9/18).
Aug
18
answered How to append an "checkbox" into dialog by using pywin32
Aug
15
comment Compiling *.mm with GCC
You also need to either use clang++ instead of clang or add -lstdc++ to the command line if you use any pieces of the C++ standard library, otherwise you'll get linker errors for that as well. If you're using pure Objective-C instead of Objective-C++, then you should use the .m file extension instead of .mm.
Aug
15
comment How to include a quote in a raw Python string?
@nmr: Yes, good catch, thanks. Fixed now.
Aug
15
revised How to include a quote in a raw Python string?
edited body
Aug
14
comment WaitForSingleObject waits infinitely for thread terminate
A function pointer cast is a bug waiting to happen.
Aug
14
comment fchmod() unable to apply file permissions correctly in C
Did you listen to your compiler at all? Even at the default settings, your compiler should be warning you with something like "warning: incompatible pointer to integer conversion passing 'FILE *' (aka 'struct __sFILE *') to parameter of type 'int'". That should be a big red flag that something is wrong with your code.
Aug
13
awarded Good Answer
1 2 3 4 5