Thread: typedef problem vs c++

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    1

    typedef problem vs c++

    xxx.h has
    #define EXTERNAL WINAPI
    #define RFAR far
    .....
    .......
    yy.h has
    #include xxx.h

    typedef unsigned short RDM_SESS
    .....
    .......
    typedef void(EXTERNAL *ERRORPROC)(short,RDM_SESS,void RFAR*);

    this last line is causing compile errors ( vs 2010) like RFAR illegal use of type void

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Don't use uppercase names for anything other than macro names.

    Then you won't get caught out by having symbols you use (which aren't macros) being randomly replaced because someone chooses to define something like RFAR.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    The issue of name clashes with macros aside, I suspect the problem is that modern compilers do not use or recognise far pointer types.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Typedef Problem
    By 8Aus9 in forum C Programming
    Replies: 3
    Last Post: 10-21-2010, 02:42 AM
  2. typedef problem
    By someprogr in forum C Programming
    Replies: 3
    Last Post: 01-25-2009, 05:46 AM
  3. Typedef problem
    By ToniShinobi in forum C Programming
    Replies: 11
    Last Post: 01-26-2008, 02:13 PM
  4. typedef problem
    By anarchypower in forum C Programming
    Replies: 8
    Last Post: 12-31-2006, 04:47 PM
  5. typedef problem
    By dr$brown in forum C Programming
    Replies: 6
    Last Post: 12-25-2004, 12:27 PM

Tags for this Thread