[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KConfigIniBackend::stringToPrintable optimization patch
From:       Alex Merry <kde () randomguy3 ! me ! uk>
Date:       2009-05-29 22:55:20
Message-ID: 200905292355.27149.kde () randomguy3 ! me ! uk
[Download RAW message or body]


On Friday 29 May 2009 09:41:38 Mirko Boehm wrote:
> > please use
> >   char *variable = ...
>
> It is a character pointer, that is the type of the variable. It is not
> a character that happens to be pointing to something. So it should be
> char* var, not char *var. The latter structure requires you to read
> the whole statement, only to figure out that the first thing you
> understood (char) was wrong.

While that is what sanity would dictate, it is not how the language is 
defined.  In C and C++, the * is attached to the variable name, not the type.  
Using
char* variable;
instead of
char *variable;
suggests that
char* a, b;
will give you two pointers, rather than one pointer and one char.

So, yes, chalk it down to a quirk of C, inherited by C++.

Alex


-- 
Why have I got six monitors?  Because I haven't got room for eight.
  -- Terry Pratchett


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic