Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Darwin: Weird call to structure constructor in formatter.h




On 4 Feb 2007, at 09:51, Daniel Stenning wrote:

I am puzzled by this line  in formatter.h   in OS/X  Darwin
 ( ie  BSD  Unix ) :

_M_parameters[_M_num_parameters++] = _Parameter(__value, __name);

Can anyone explain  WHY ?????


Here, _Parameter(__value, __name) - far as I can tell - is one of many
structure constructors, and thus should NOT return any value !!!

I'm not a C++ syntax expert, but I think you're misunderstanding what this does -- that's not a literal constructor call (as in this- >_Parameter()) but a class name used in object creation (which of course does call a constructor).


I know in our code we end up with stuff like

this->notify(String("foo"));

which makes a temporary String object and passes it to the notify method.

So presumably in the code you question a _Parameter is created and then operator= is called.


David Dunham A Sharp, LLC
Voice/Fax: 206 783 7404 http://a-sharp.com
"People seem to misinterpret complexity as sophistication" -- Niklaus Wirth



_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >Darwin: Weird call to structure constructor in formatter.h (From: Daniel Stenning <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.