Invalid Write and Read in Linux not in Mac OS X

I've been testing some C codes on Mac OS X and they seemed to work fine, but when I ran them on Linux some segmentation faults appeared. So I checked my code with valgrind and discovered some invalid writes and reads. Does any one knows why it doesn't crash on Mac? Could it be because on Mac I'm always the super user, due to I only have one user account and Linux compels me to create a root account and a user account. (Linux Kubuntu 8.10 - Mac OS X 10.5 )

Note: I did not use any specific-system library. All ansi code.

Thanks
Last edited on
No. It depends on what the invalid writes/reads are. Chances are you are writing/reading memory locations that are within your process' address space on MAC OS X but not on Linux. Process address space layout is OS dependent.
...and variable --it can be different each time you run your program, and it can change while your program is running.

A week, month, year, or ten minutes from now it may segfault your Mac too...

Just make sure you aren't ever trying to dereference anything that doesn't belong to you.

Good luck!
Topic archived. No new replies allowed.