Platform independent C code

This is a discussion on Platform independent C code within the C Programming forums, part of the General Programming Boards category; Hello All, We are developing 186 based embedded C code for small memory model. And in future we are planning ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    175

    Platform independent C code

    Hello All,

    We are developing 186 based embedded C code for small memory model. And in future we are planning on using same C code for ARM processor under no OS.

    At this moment, we are putting processor related macros in seperate .h file. Apart from this, what care should I take while developing the code?


    Lastly, we are declaring a array of staructure as __far const. With this keyword compiler allocates memory in code memory and not is data segment. I am not sure, whether it is the way for Paradigm compiler. My question is, what does _far const mean for other compiler or is it ANSI standard?

    Please let me know.

    Thanks,

  2. #2
    .
    Join Date
    Nov 2003
    Posts
    307
    It is not standard. It allows sixteen bit pointers to reference objects offset by more than 32K bytes of memory.

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    >Apart from this, what care should I take while developing the code?

    Try to minimize the usage of target-specific stuff, or add comments to draw your attention. Basically, all of the portability issues.

    >My question is, what does _far const mean for other compiler or is it ANSI standard?

    Well _far is not standard, and it may be a syntax error for another compiler. I'd recommend using a macro wrapper, using an architecture predefined macro.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  2. Explain this C code in english
    By soadlink in forum C Programming
    Replies: 16
    Last Post: 08-31-2006, 12:48 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 11:38 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21