• 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: Bug in g++'s int constructor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in g++'s int constructor?


  • Subject: Re: Bug in g++'s int constructor?
  • From: Alex Curylo <email@hidden>
  • Date: Thu, 28 Mar 2002 22:35:20 -0800

> ints don't have "constructors"

All built in types use constructor notation () to express the default value
of that type. That's close enough to "have 'constructors'" for all except
the most rectal-cranially inverted pedants, I would think.

ip = new int; // uninitalized
ip = new int(); // initializes to zero

in any standards-compliant compiler.

> and they are not guaranteed to be initialized to any particular value
> unless you explicitly initialize it.

Hmmmmm ... well, automatic variables no, but global, static, and namespace
variables are all guaranteed zero initalization by a conformant compiler in
the absence of an explicit initializer.

In my C++ 3rd Ed. the above rules are delineated in sections 4.9.5
"Initialization" and 6.2.8 "Constructors". Look it up, as they say.

--
Alex Curylo -- email@hidden -- http://alexc.webjump.com/

"I like you better cynical than credulous, especially credulous about
the virtues of people dramatically more stupid than you are."
-- Crawford Kilian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: App dying under MallocDebug and ObjectAlloc
  • Next by Date: Re: NSView subclass never gets dealloced?
  • Previous by thread: Re: Bug in g++'s int constructor?
  • Next by thread: Re: Bug in g++'s int constructor?
  • Index(es):
    • Date
    • Thread