Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: request for...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 15 Topic 26115 of 26960
Post > Topic >>

Re: request for member in something not a structure or union

by lawrence.jones@[EMAIL PROTECTED] May 9, 2008 at 02:56 PM

cr88192 <cr88192@[EMAIL PROTECTED]
> wrote:
> 
> why exactly is it that . and -> were originally made to be separate 
> operators anyways?...

Because back in the old days, there was no requirement that the left
operand have a structure or pointer to structure type.  You could (and
people did!) use . or -> on integers, arrays, or whatever.  Since the
operators do different things, they had to be distinct so the user could
specify which operation was desired.  Now that the left operand is
restricted, there's no technical reason for having distinct operators. 
Given that they already exist, however, there doesn't seem to be any
particular benefit to merging them and there would be real costs
involved to do so.

> what exactly is the cost of, say, a compiler implementor being lazy and 
> treating both cases as equivalent? (well, apart from maybe the risk of a

> user writing code which will promptly break if used on a more 
> standards-conformant compiler...).

Although you describe it as being "lazy", I can't imagine that
implementing one operator that can do either of two things is any less
work than implementing two operators each of which only does one thing.

-- Larry Jones

Years from now when I'm successful and happy, ...and he's in
prison... I hope I'm not too mature to gloat. -- Calvin
 




 15 Posts in Topic:
request for member in something not a structure or union
deepak <deepakpjose@[E  2008-05-08 02:12:57 
Re: request for member in something not a structure or union
pete <pfiland@[EMAIL P  2008-05-08 05:22:08 
Re: request for member in something not a structure or union
"cr88192" <c  2008-05-09 17:50:20 
Re: request for member in something not a structure or union
lawrence.jones@[EMAIL PRO  2008-05-09 14:56:54 
Re: request for member in something not a structure or union
"cr88192" <c  2008-05-10 06:59:01 
Re: request for member in something not a structure or union
Nick Keighley <nick_ke  2008-05-08 02:23:03 
Re: request for member in something not a structure or union
Richard Heathfield <rj  2008-05-08 09:27:30 
Re: request for member in something not a structure or union
viza <tom.viza@[EMAIL   2008-05-08 03:09:36 
Re: request for member in something not a structure or union
Bart <bc@[EMAIL PROTEC  2008-05-09 04:20:10 
Re: request for member in something not a structure or union
richard@[EMAIL PROTECTED]  2008-05-09 12:06:46 
Re: request for member in something not a structure or union
Keith Thompson <kst-u@  2008-05-09 11:32:10 
Re: request for member in something not a structure or union
Bart <bc@[EMAIL PROTEC  2008-05-09 12:30:34 
Re: request for member in something not a structure or union
Chris Torek <nospam@[E  2008-05-09 19:50:08 
Re: request for member in something not a structure or union
richard@[EMAIL PROTECTED]  2008-05-09 20:26:43 
Re: request for member in something not a structure or union
Keith Thompson <kst-u@  2008-05-09 14:24:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 16:42:45 CDT 2008.