Re: preprozessor and #define Problem
From: Minti (mintiSPAMBLOCK_at_yahoo.com)
Date: 06/26/04
- Next message: Malcolm: "Re: Callbacks in C"
- Previous message: Emmanuel Delahaye: "Re: keyword extern"
- In reply to: Peter Nilsson: "Re: preprozessor and #define Problem"
- Next in thread: Peter Nilsson: "Re: preprozessor and #define Problem"
- Reply: Peter Nilsson: "Re: preprozessor and #define Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Jun 2004 01:13:57 -0700
"Peter Nilsson" <airia@acay.com.au> wrote in message news:<40dcd6d8$1@news.rivernet.com.au>...
> "Daniel Wild" <dawitronik@web.de> wrote in message
> news:cbh3ln$4los7$1@hades.rz.uni-saarland.de...
> > Hello,
> >
> > I have a problem with a macro which will return a pointer.
> > In the header trolley_position_SL_GR is defined:
> > #define trolley_position_SL_GR ((real_T*) ssGetPWorkValue(S,4))
> >
> > The function ssGetPWorkValue return a pointer on real_T.
>
> Then why do you cast it's return value?
>
> > If I use something like:
> >
> > real_T *test;
> > test = (real_T*) ssGetPWorkValue(S,4);
> > //or
> > test = *((real_T*) ssGetPWorkValue(S,4)+4); // for example
> >
> > everything works fine.
> > If I use:
> > teal_T *test;
> > test = *(trolley_position_SL_GR+6);
> > Now, I get a segmentation fault and if I set it in brackets like :
> > test = *((trolley_position_SL_GR)+6);
> > it works!
> >
> > Can someone explain this phenomenon?´
>
> Please post the smallest _compilable_ snippet that exhibits the problem. Don't retype, use
> copy and paste. [Merely getting the code to postable form may well provide you with the
> answer.]
>
> > I use Visual Studio 6 as c-compiler.
>
> If that's relevant, then chances are you're posting to the wrong group.
Why can't this point be relevant in c.l.c? OP posted strictly
conforming code, unless of course you consider using user defined
types, directive or functions in c.l.c to be invalid. It is obviously
quite certain/obvious that OP thought that this comment might help in
better diagnosis of the problem.
Comments like these are 100% irrelevent and just waste my precious
little 28kbps bandwidth.
I am not impressed.
-- Imanpreet Singh Arora isingh AT acm DOT org
- Next message: Malcolm: "Re: Callbacks in C"
- Previous message: Emmanuel Delahaye: "Re: keyword extern"
- In reply to: Peter Nilsson: "Re: preprozessor and #define Problem"
- Next in thread: Peter Nilsson: "Re: preprozessor and #define Problem"
- Reply: Peter Nilsson: "Re: preprozessor and #define Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|