• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Darwin: Weird call to structure constructor in formatter.h
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: Darwin: Weird call to structure constructor in formatter.h
  • From: Daniel Stenning <email@hidden>
  • Date: Sun, 04 Feb 2007 18:16:30 +0000
  • Thread-topic: Darwin: Weird call to structure constructor in formatter.h

So are you saying that one can instantiate that structure via the
constructor WITHOUT  using the new keyword ?

Out of curiositiy , why would one do that ?

On 4/2/07 18:00, "Marshall Clow" <email@hidden> 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 !!!
>
> When you call a constructor, an object gets created; that's what
> constructors do.
> That object is then assigned into the array.
>
> When you write a constructor, you do not declare a return type -
> the compiler knows what you are doing and does some behind the scenes work
> to make this all happen.
>
>
>> The structure _Parameter{}  is  declared inside class _Error_formatter.
>>
>>
>> The complete code for the section concerned is:
>>
>>     const _Error_formatter&
>>     _M_string(const char* __value, const char* __name = 0) const
>>     {
>>       if (_M_num_parameters < __max_parameters)
>>     _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
>>       return *this;
>>     }
>
> if _Parameter declares a public constructor that takes params of the form
> ( const char *, const char * )
> then I see nothing wrong (nor unusual) here.


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

This email sent to email@hidden

  • Follow-Ups:
    • Re: Darwin: Weird call to structure constructor in formatter.h
      • From: Marshall Clow <email@hidden>
References: 
 >Re: Darwin: Weird call to structure constructor in formatter.h (From: Marshall Clow <email@hidden>)

  • Prev by Date: Re: Darwin: Weird call to structure constructor in formatter.h
  • Next by Date: Re: Xcode dependency handling
  • Previous by thread: Re: Darwin: Weird call to structure constructor in formatter.h
  • Next by thread: Re: Darwin: Weird call to structure constructor in formatter.h
  • Index(es):
    • Date
    • Thread