🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42698

difference between x->y and *(x.y)???

#42698
From: Asko Seeba
Date: Thu, 09 Nov 1995 00:00
40 lines
1230 bytes
class ID {
  long     type;          // Type of identifier.
  union Id {
    thread_t thread_id;
    int      int_id;
    String * string_id;
  } id;
 public:
  ID( thread_t );
  ID( int );
  ID( String );
  ID( ID * );
  ~ID();
  int operator ==( ID );
  int operator !=( ID );
  ID  operator =( ID );
  friend sh_int DefaultHashFun( const ID * );
};

If i wrote

    case STRING: return ( id->string_id != ident.id->string_id );

then compiler cried:

id.cc:54: base operand of `->' is not a pointer
id.cc:54: base operand of `->' is not a pointer

ident is ID type.
If i wrote

    case STRING: return ( *( id.string_id ) != *( ident.id.string_id ) );

then compiler ate it :). To this point i thought that it is the same... but
now i start to think something else... but what? dunno... Can anyone explain
it?


--
Asko Seeba.
Technical Details
Message-ID: <47u2jr$ie0@kadri.ut.ee>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,5db05e0c31fa17a8,start
X-Google-Attributes: gid11318c,public
From: asko@hapnik.ut.ee (Asko Seeba)
Subject: difference between x->y and *(x.y)???
Date: 1995/11/09
Message-ID: <47u2jr$ie0@kadri.ut.ee>
X-Deja-AN: 119014269
organization: Tartu University, Estonia
newsgroups: gnu.gcc.help