home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

What does -> mean?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2408
Discussions: 200,942, Posts: 2,379,325, Members: 246,305
Old June 8th, 2003, 04:05 PM   Digg it!   #1 (permalink)
Ultimate Member
 
nukes's Avatar
 
Join Date: Oct 2002
Location: Scotland, UK
Posts: 3,221
Send a message via AIM to nukes Send a message via Yahoo to nukes
What does -> mean?

I am trying to learn SDL so I can make a real go with cpp, one thing I'm stuck on right now is the -> operator in the function calls, what does it mean? I get the feeling this is something simple enough, but I just haven't been able t find information on it. Its used for stuff in the gfx calls etc.
ok, i've found this:
expr1 -> field: returns the value of field in the structure pointed to by expr1.

So expr1 is a pointer to a struct, and a field is just one of the variables in it? is that right?
__________________
_____
NuKeS

Last edited by nukes : June 8th, 2003 at 04:07 PM.
nukes is offline   Reply With Quote
Old June 8th, 2003, 08:42 PM     #2 (permalink)
Ultimate Member
 
strangerstill's Avatar
 
Join Date: Oct 2001
Posts: 1,542
a->b is synonymous with *(a.b)
it's just syntactic sugar, like a[b] is *(a+b)
strangerstill is offline   Reply With Quote
Old June 8th, 2003, 09:13 PM     #3 (permalink)
Member
 
Join Date: Feb 2002
Posts: 161
Close ... it's synonymous with (*a).b
Martee is offline   Reply With Quote
Old June 9th, 2003, 09:43 AM     #4 (permalink)
Ultimate Member
 
nukes's Avatar
 
Join Date: Oct 2002
Location: Scotland, UK
Posts: 3,221
Send a message via AIM to nukes Send a message via Yahoo to nukes
dgfh.
so screen->format->BitsPerPixel
means format is a class with the varisable bitsperpixel. Screen is a class with format included in it as well?
Is that right?
Code:
class display {
public:
int bitsperpixel;
}
class surface {
public:
display format; }
surface *screen;
Is this the right idea?
(ignore the syntax errors I am still learning and want to check I get THIS idea.) Thanks for your help.
nukes is offline   Reply With Quote
Old June 9th, 2003, 09:51 PM     #5 (permalink)
Member
 
Join Date: Feb 2002
Posts: 161
Yes, except that in the surface class, format would be a pointer, not an actual display object. With the code you posted, bitsperpixel would be accessed like screen->format.bitsperpixel. If format was a pointer, then it would be screen->format->bitsperpixel.
Martee is offline   Reply With Quote
Old June 9th, 2003, 09:57 PM     #6 (permalink)
Ultimate Member
 
strangerstill's Avatar
 
Join Date: Oct 2001
Posts: 1,542
Oops!

(it was late and i was tired...)
strangerstill is offline   Reply With Quote
Old June 11th, 2003, 04:18 PM     #7 (permalink)
Ultimate Member
 
nukes's Avatar
 
Join Date: Oct 2002
Location: Scotland, UK
Posts: 3,221
Send a message via AIM to nukes Send a message via Yahoo to nukes
Right, thanks, I was just confused by the syntax. Now I may start to make some progress.
nukes is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
The disrespect of Obama by Russian .. (14)
Making Health Care Worse (156)
Is It Just Me? (2918)
Wireless Televisions. (11)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Regular Build (6)
Is the PSU I received dead? (11)
Print spooler problem (15)
HIS HD5770 graphic card question (15)
windows vista security holes (9)
Install XP pro and a Vista laptop ?.. (11)
Foreign voltage (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Recent Discussions
BSOD On Startup (ntoskrnl.exe) (2)
Print spooler problem (15)
Laptop with wireless problem. (1)
Wireless Televisions. (11)
Have you switched yet? (86)
Asus P4G8X Mobo (5)
screen resolution vs monitor size (2)
radeon x850xt platinum & shader 3 (4)
sms storage to PC (0)
Regular Build (6)
Open With ..... Win7 (0)
java code for fibonacci (1)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (35)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Partition Magic caused HDD problem (3)
Is the PSU I received dead? (11)
Point and Shoot Camera Suggestions. (2)
Modern Warfare 2 freeze (13)
wireless user (1)
World's largest Monopoly Game using G.. (332)
Ideal cheap graph card for PC-Gaming? (17)
BIOS won't read disk when I try to fl.. (0)
Install XP pro and a Vista laptop ?? (11)
Graphics Card Upgrade Question (1)


All times are GMT -4. The time now is 05:18 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28