octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] Building Octave with GCC 3.1


From: Mumit Khan
Subject: Re: [patch] Building Octave with GCC 3.1
Date: Fri, 17 May 2002 20:04:08 -0500 (CDT)

On Fri, 17 May 2002, John W. Eaton wrote:

> I was trying to avoid creating objects that might not have a value.
> What happens if you create a double this way, for example?  But I
> don't suppose it matters too much for Octave, since the derived
> classes that are actually used provide their own resize_fill_value
> functions that do the right thing.  Is there any way to automatically
> do this "correctly" so that numeric types are automatically
> initialized to zero, and others have the default constructor applied?

That's the idea described in 8.5/5 (zero and default initialization) and
8.5/7 (default initialization). Basically it says the following: given
a initialization of the form T(), T is default is initialized; to
default initialize an object of type T is to:
  - if T is non-POD, then default constructor is called.
  - if T is an array, each element is default initialized.
  - otherwise, storage for T is *zero* initialized.

The last point implies that T() for T any numeric type guarantees zero
initialization (ie., 0 converted to the type T). Pre-ANSI C++ didn't
support int() or double(), but the use of STL, or rather temlates, made
it essential to support this form for builtins in C++ as well.

> I've applied your changes and compiled with 2.95 (that's still my
> default compiler, which explains the lack of std:: qualifiers).

Hopefully these changes don't break 2.95.x.

Regards,
Mumit




reply via email to

[Prev in Thread] Current Thread [Next in Thread]