Today's Question:  What are you most afraid of as a programmer?        GIVE A SHOUT

Technical Article => Programming =>  C

C programming tips in SPARC architecture

  NanXiao      2014-06-01 03:56:30      5,003    0    1

If you are a newbie of C programmers in SPARC architecture (For example, working on Solaris), you should pay attention to the following tips:

(1) By default, SPARC is big-endian (For Endianness, you can refer http://en.wikipedia.org/wiki/Endianness). It means for an integer (short, int, long, etc), the MSB will be stored in the lower address, while the LSB will be stored in the higher address. 

(2) SPARC requires byte-alignment. It means for a short (2 bytes long) variable, the start address of the variable must be the multiples of 2, while a int (4 bytes long) variable, the start address of the variable must be the multiples of 4. If the address can't satisfy this condition, the application will core dump, and a "Bus Error" will be reported. For this tip, you can refer Expert C Programming: Deep C Secrets (Bus Error section, page 163 ~ page 164).

 

For more SPARC information, you can refer:

http://en.wikipedia.org/wiki/SPARC;

SPARC Processor Issues.

 

C

  SAVE AS PDF   MARK AS READ   MARK AS IMPORTANT

Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious

  RELATED


No related articles

  0 COMMENT


No comment for this article.


  WRITE ARTICLE

Vitamin water label

By sonic0002
If you woke up tired, you need more sleep. If you woke up drooling on your desk, you need a new job. If you woke up with a headache, somewhere in clarke quay, with dried mee goreng stuck to your face, you probably need answers, and a drink. Why not this product, huh? It's got potassium and b vitamin