Dont use null pointers directly in solaris

        Code : char * text= NULL;  int text_len=strlen(text);

Above code, if it is used in linux, it works fine. text_len variable value will be 0. But the same code, if it is used in solaris, it gives segmentation fault. When I first encountered this problem, I struggled for 1 day debugging my code for the bug and finally I found this very good link solaris-null-pointer-bug.

It was intentionally implemented in solaris to catch the poorly written code. So, if we first check our (char *) pointer is NULL or not, there won’t be any problem. If you are too lazy to do all this, you can either use setenv LD_PRELOAD_32 /usr/lib/0@0.so.1

Advertisements

4 Comments

  1. Anand Verma said,

    October 5, 2006 at 9:30 am

    As usual I suggest USE LINUX.

    Regards,
    Anand

  2. DP said,

    October 5, 2006 at 10:02 am

    Thank you anand, but LINUX is not as feature-rich, powerful as solaris. Moreover, there is INNOVATION is solaris.

  3. Anand Verma said,

    October 16, 2006 at 8:10 am

    Hi DP,

    Ok but it is more user friendly.
    Why dont we port DTrace and other utilities to Linux so that it become more powerful and feature rich.
    Then it will have features and usability.

  4. DP said,

    October 16, 2006 at 8:45 am

    I think there are some projects already working on dtrace porting. Anyway Dtrace ports in linux cannot match Dtrace in solaris. Even then, it is not only about Dtrace. What about solaris containers??

    Solaris has JDS [java desktop system] which is decent and user friendly. Moreover, with Sun Solaris comes lot of development tools.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: