473,320 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

C - Macro problem with nested structures

2
I define a macro like this:

Expand|Select|Wrap|Line Numbers
  1. #define L(p) ((p).value.len)
  2.  
  3. typedef struct node
  4. {
  5.     int dimension;
  6.     int position;
  7.     int size;
  8.  
  9.     union 
  10.     {
  11.         long len;
  12.         float f;
  13.  
  14.         } value;
  15.  
  16.     struct node *prev;
  17.     struct node *next;
  18.  
  19. } node, *np;
  20.  
and later,when I try to use that macro,
I have this error:
"error:request for member 'value' in something not a structure or union "

So can you please help me to fix this problem?
Is there any other way to define macros for nested structs?
Jun 16 '11 #1
2 2408
Banfa
9,065 Expert Mod 8TB
We need to see the code that uses the macro as in addition to what you have already posted.

But my guess is that you have passed a pointer to your macro which is expecting a structure.
Jun 16 '11 #2
Cagin
2
Yeah, you are right. I used to have a pointer problem, I fixed it. Thanks for help.
Jun 16 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michele Simionato | last post by:
I am getting trouble with nested triple quoted strings in doctest. For instance $ cat x.py """ >>> dummy = ''' something here ''' """
1
by: alon | last post by:
hello, i have a problem , i am a new user at access , i am using access 2000 , when i am making macro with msgbox the access stucks, i have check the same file with the macro on other computer and...
17
by: ethan | last post by:
Hi All, How to write a macro with variable length of argument? For example, if i need a macro to check return value of printf. #define PRINTF_ESC(x, ...) if(printf(x, ...) == 10) goto end; ...
3
by: Luis Diego Fallas | last post by:
Hi everyone , I'm having a problem when trying to compile code that contains the following pattern: using System; public class A { public class B : Inn.C { }
0
by: Andre | last post by:
Hi, I have a problem with marshaling nested structures struct a { struct b s_b; struct d s_d;
6
by: rashmi | last post by:
Hello All, Can we map a MACRO with variable number of arguments to a function with variable number of arguments? Please help me in finding out how this could be done ? for eg: #define...
2
by: samba | last post by:
I having a nested structures which are referenced with pointer variables #include <stdio.h> struct test { int i; char *mytest; }; struct sample {
3
by: Amit_Basnak | last post by:
Dear Friends I have the follwoing function "tss_fe_get_own_info" which has the arguments as shows below tss_fe_get_own_info(char *user_id, tss_user_profile_t **p_buf_UserSecInfo, error_status_t...
0
by: Tom Johnson | last post by:
I am trying to load an XML file into a .Net DataSet using the ReadXml method (in C#). The file is from the game EVE Online and is available at: http://api.eve-online.com/eve/SkillTree.xml.aspx ...
8
by: Sheldon | last post by:
Hi, Can anyone help with this problem with setting up nested structures and initializing them for use. I have created several structs and placed them in a super struct that I will then pass to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.