Re: static typing (Learning Cocoa Chapter 13)
Re: static typing (Learning Cocoa Chapter 13)
- Subject: Re: static typing (Learning Cocoa Chapter 13)
- From: Chris Rudolph <email@hidden>
- Date: Fri, 21 Sep 2001 15:07:43 -0700
This simple and more elegant solution is to NOT declare multiple
variables on the same line.
- Chris.
On Friday, September 21, 2001, at 02:09 PM, Erik M. Buck wrote:
In the name of aesthetic flame wars:
The asterisk indicates that a variable is a pointer not that a type is a
pointer. The asterisk therefore belongs with the variable and not the
type.
The simplest highlight of that fact follows:
char *foo, bar, *baz;
foo is a pointer (probably 4 bytes)
bar is a character (probably 1 byte)
baz is a pointer (probably 4 bytes)
If the pointerness was part of the type then
char* foo, bar, *baz;
would make foo a pointer, bar a pointer, and baz a pointer to a pointer
which is of course wrong and ludicrous.
----- Original Message -----
From: "John Pannell" <email@hidden>
To: "Cocoa Developer" <email@hidden>
Sent: Friday, September 21, 2001 2:36 PM
Subject: Re: static typing (Learning Cocoa Chapter 13)
Just to add an extra tidbit... the asterisk can appear _appended_ to
the
type, or _prepended_ to the variable. For example:
NSButton* myButton file://right
NSButton *myButton file://also right
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
--
Chris Rudolph, AppleWorks Engineering
Apple Computer, Inc.
email@hidden