Thread: Nasty looking thing

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    4

    Nasty looking thing

    I tought that I was OK at C until I was working on this just now. I am working through someones Framework and modifying it for my needs.

    On trying to read it, I found this:

    Code:
    static xdata setup_dat * data sdat = (xdata setup_dat *)&SETUPDAT;
    Im not sure if any of you guys are familiar with the 8051 processor and if not then just ignore the "xdata" and "data" statments as they are just different RAM spaces.

    Can you tell me what this whole thing means?

    If you are an 8051 developer then I have another question.

    Code:
    xdata type * data variable
    Is that the decleration of a pointer in data that points to something in xdata OR a pointer in xdata that points to something in data?

    That hurts?
    Last edited by richard_hooper; 05-27-2005 at 02:40 AM.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by richard_hooper
    Code:
    xdata type * data variable
    Is that the decleration of a pointer in data that points to something in xdata OR a pointer in xdata that points to something in data?
    I believe you start reading from the right to the left, so "variable is a data pointer to type; the pointer is xdata. So the pointer is in data, but the data it points to is in xdata(?). (My 8051 is rusty.)
    Last edited by Dave_Sinkula; 05-27-2005 at 11:09 AM. Reason: Fixing(?) my previous unfixing.
    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.*

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    8051 uses a different type of ansi?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by Devil Panther
    8051 uses a different type of ansi?
    No. The implementation has language extensions (just like MSVC, GnuC, etc.).
    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. Pause/idle thing
    By freedik in forum Windows Programming
    Replies: 13
    Last Post: 08-22-2003, 09:46 AM
  2. A very strange thing
    By gustavosserra in forum C++ Programming
    Replies: 4
    Last Post: 04-15-2003, 12:43 PM
  3. most challenging thing to program
    By volk in forum A Brief History of Cprogramming.com
    Replies: 52
    Last Post: 03-28-2003, 03:56 PM
  4. newbie needs help comprehending simple thing
    By A helpless one in forum C++ Programming
    Replies: 6
    Last Post: 12-16-2002, 09:23 PM