Topic: static array initialization


Author: Dave Berton <db@null.net>
Date: Tue, 20 Feb 2001 17:14:11 GMT
Raw View
Given:

static const char* three()
{
    return "three";
}

static const char* const a[] =
{
    "one",
    "two",
    three()
};

8.5.1.2 of the standard says that an array can be initialized with a
comma-separated list of initializers for the members of the aggregate.
However, is it legal to initialize one of the members of the static array
'a' with a function call?  Why or why not?

db

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]