c++

Gert Cuykens gert.cuykens at gmail.com
Sun Feb 20 15:34:47 GMT 2005


On Sun, 20 Feb 2005 12:47:50 +0000, Scott Mitchell
<scott+lists.freebsd at fishballoon.org> wrote:
> On Sun, Feb 20, 2005 at 08:41:30AM +0100, Gert Cuykens wrote:
> >
> > So if data is declared as a gchar *data; for example, then the value
> > of data is a memory adress right ? So if A=data; and B=&data; then A
> > and B are exactly the same result right ?
> 
> No.  A is a 'pointer to gchar' (or gchar*) and B is a 'pointer to pointer
> to gchar' (or gchar**).  The '&data' syntax means 'the address of the data
> variable', ie. the address of a gchar*, whereas data itself contains the
> address of a gchar.
> 
> > Now why would anybody want a gchar when a integer is needed ? That is
> > just making it more complicated then it already is?
> 
> Because the code in question deals with gchars (whatever they are) not
> integers?  They won't necessarily be the same thing on different
> architectures, or even different compilers on the same architecture.  Also,
> the type is called 'gchar' presumably because it logically holds some kind
> of character data, whereas an integer variable holds an integer.  Calling
> them different things in the code helps to make it clear what the
> programmer's intention is, even if the two types happen to have the same
> representation on a given machine/compiler.
> 
> In any case, this stuff really has nothing to do with FreeBSD - you should
> be asking these questions in a C/C++ programming group.
> 
> Cheers,
> 
>         Scott
> 
> --

Thx i think i understand now :)

PS Freebsd source is c++ right ? So you could also call this the free
c++ question mailing list :)

Also about all the get a c++ book comments, i tryed that once but when
i ask the book a question, it doesnt say anything back. It only makes
noises when you flaper the pages trough the wind.

By the way if somebody passing your street asking for direction you
dont answer get a map either right ?


More information about the freebsd-questions mailing list