Boost logo

Boost :

From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2003-12-24 23:33:27


Quoth http://boost.org/libs/array/array.html :

> Could "{ ... }" be used portably instead of "{ { ... } }" to
> initialize values?
> 8.5.1 (11) of the Standard seems to allow it; however, gcc
> 2.95.2 prints a warning message.

C:\Temp>type array.cc
#include <iostream>
#include <boost/array.hpp>
using namespace std;
using namespace boost;

int main() {
    array<int, 4> a = { 15, 20, 25, 30 };

    cout << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << endl;
}

C:\Temp>g++ --version
g++ (GCC) 3.3 (mingw special 20030514-1)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\Temp>g++ -Wall -W array.cc -o array.exe

C:\Temp>array
15 20 25 30

C:\Temp>

I would therefore conclude that 2.95.2 sucks and 3.3 conforms more closely
to the Standard (of course, 2.95.2 is free to /warn/ about anything it
likes, but that doesn't stop it from sucking).

Stephan T. Lavavej
http://nuwen.net


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk