473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error message explained

mdh
I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.

int main (int argc, const char * argv[]) {
struct point {
int x;
int y;
};

struct point *pp;
struct point origin;
pp= &origin;

origin = makepoint(23, 67);

printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member 'y'
in something not a structure or union*/

}

Thanks in advance

Aug 23 '08 #1
6 2256
On Aug 23, 6:41 pm, mdh <m...@comcast.n etwrote:
I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.

int main (int argc, const char * argv[]) {

struct point {
int x;
int y;

};

struct point *pp;
struct point origin;
pp= &origin;

origin = makepoint(23, 67);

printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member 'y'
in something not a structure or union*/

}
See operator precedence.
.. bounds tigher than *

*pp.y means *(pp.y)

pp is a pointer, . requires structure or union
Aug 23 '08 #2
mdh wrote:
I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.

int main (int argc, const char * argv[]) {
struct point {
int x;
int y;
};

struct point *pp;
struct point origin;
pp= &origin;

origin = makepoint(23, 67);

printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member 'y'
in something not a structure or union*/

}

Thanks in advance
It's a snytax error. As written *pp.y assumes pp a structure and y a
pointer to int. None of that is true.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Aug 23 '08 #3
mdh
On Aug 23, 8:57*am, Joe Wright <joewwri...@com cast.netwrote:
mdh wrote:
I understand *why* this produces an error and how to correct it,
snip

int main (int argc, const char * argv[]) {
struct point {
* *int x;
* *int y;
};
* *struct point *pp;
* *struct point origin;
* *pp= &origin;
>
* *printf("%d, %d\n", (*pp).x, *pp.y); */*error: request for member 'y'
in something not a structure or union*/
>
It's a snytax error. As written *pp.y assumes pp a structure and y a
pointer to int. None of that is true.
Thanks Joe...yes that makes sense. One more eclectism falls :-)
Aug 23 '08 #4
mdh
On Aug 23, 8:57*am, vipps...@gmail. com wrote:
>
pp is a pointer, . requires structure or union

thanks
Aug 23 '08 #5
On Sat, 23 Aug 2008 11:57:15 -0400, Joe Wright wrote:
mdh wrote:
> struct point *pp;
[...]
printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member
'y'
>in something not a structure or union*/
It's a snytax error.
No, it's not, unless snytax is an intentional misspelling that I am not
familiar with. *pp.y is syntactically valid, but semantically invalid.
Aug 23 '08 #6
On 23 Aug, 16:41, mdh <m...@comcast.n etwrote:
I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.

int main (int argc, const char * argv[]) {

struct point {
* * * * int x;
* * * * int y;

};

* * * * struct point *pp;
* * * * struct point origin;
* * * * pp= &origin;

* * * * origin = makepoint(23, 67);

* * * * printf("%d, %d\n", (*pp).x, *pp.y); */*error: request for member 'y'
in something not a structure or union*/

}

Thanks in advance
Erm, it seems to make perfect sense to me. The '.' means you are
accessing a member of a struct or union, so pp.y means "access the
member called 'y' of the struct or union pp". Which is wrong, beacause
pp is not a struct or union - it is a pointer to a struct. So pp isn't
a struct or a union, and it doesn't have members. So it's an error to
access member 'y' of it.
Aug 23 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
1925
by: kosuke | last post by:
I keep getting the following error/warning message when using the python based program getmail4: /usr/lib/python2.3/optparse.py:668: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up return ("<%s at 0x%x: %r>" I'm using python2.3.5 on a debian sid box. The getmail4 website/FAQ maintains that...
5
1849
by: Bill | last post by:
I have perhaps not explained myself clearly, so I'll try it this way. In the code below, where it says "I'd like to include my navigation bar here" is the place I'd like to insert a navigation bar from a page I have called navbar.asp For some reason, when I insert the <! #include file="navbar.asp" --> in that place, I get an error, a long,...
28
2336
by: Steve Bywaters | last post by:
There are several hundred of my client's franchisees happily accessing my ASP/VBscript web site... but one - just one - has reported the following: "I have been trying to log onto the LSM since friday and get this message when I want to go into any of the items on Home Page. Response object error 'ASP 0156: '80004000' Header error...
2
6283
by: dmiller23462 | last post by:
Hey guys, I'm back again....I've got the results displaying that I wanted but instead of having a "next" or "previous" link displayed I am getting the error msg below (I actually get the data that I'm supposed to get meaning that my query seems to be working fine but instead of making its way to the INCLUDE file (bottom navigation bar) it...
5
744
by: Bob | last post by:
Hi Everybody I hope you can help. 2 related questions. 1. I am looking for a way to replace the confusing message box that comes up when a user trys to open a form without putting data in it. ie ..Syntax Error(Missing Operator) In queryexpression '=" & Me! DoCmd.OpenForm stDocName, , , stLinkCriteria
13
4450
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of...
20
3544
by: Blah | last post by:
In MSDN documentation it states.. Remarks The constant declaration can declare multiple constants, for example: public const double x = 1.0, y = 2.0, z = 3.0; The static modifier is not allowed in a constant declaration. A constant can participate in a constant expression, for example:
10
2274
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on that ID, otherwise...
7
11457
by: Tony Girgenti | last post by:
Hello. I'm developing and testing a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 computer. I'm using a web form. I'm trying create a function in javascript to compare dates between calendar selected dates(that's not really my problem yet). I can't get the html to...
9
2941
by: i | last post by:
#include<stdio.h> #include<conio.h> #include<process.h> #include<string.h> char ch; int n,m; void main(); char check(int,int,char); void cash(int,int,char); void debit_card(int,int,char);
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.