Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6642

Re: const void * in structure

From RaZiel <raziel_206_@hotmail.com>
Newsgroups alt.comp.lang.delphi, comp.lang.c++
Subject Re: const void * in structure
Date 2011-06-12 05:51 +0200
Organization Aioe.org NNTP Server
Message-ID <it1d45$9f3$3@speranza.aioe.org> (permalink)
References <3f4f3$4df4035d$5419acc3$13678@cache4.tilbu1.nb.home.nl>

Cross-posted to 2 groups.

Show all headers | View raw


On 12.06.2011 02:07, Skybuck Flying wrote:
> Hello,
>
> I come across the following C/C++ code which is a bit unfamiliar to me:
>
> const void *SomeField2; // *
>
> typedef struct SomeStructureName1 {
> int SomeField1;
> const void *SomeField2; // *
> int SomeField3;
> } SomeStructureName2;
>
> It seems like a "constant void pointer type"
>
> How to translate this structure to Delphi ?
>
> My guess would be:
>
> type
> SomeStructureName1 = record
> SomeField1 : integer;
> SomeField2 : pointer;
> SomeField3 : integer;
> end;
> SomeStructureName2 = SomeStructureName1;
>
> Also is it just a "syntax" difference or is there a binary difference
> between
>
> 1. void *
> vs
> 2. const void *
>
> ?
>
> Bye,
> Skybuck.

It's easier to read C++ declarations from right to left when pointers 
are involved. So the type is "pointer to constant void".

- RaZ

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

const void * in structure "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-12 02:07 +0200
  Re: const void * in structure RaZiel <raziel_206_@hotmail.com> - 2011-06-12 05:51 +0200
  Re: const void * in structure "Heinrich Wolf" <invalid@invalid.invalid> - 2011-06-12 09:25 +0200
  Re: const void * in structure "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-06-12 12:42 -0400

csiph-web