| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Frederick Gotham" |
| Date: |
12 Sep 2006 08:19:27 PM |
| Object: |
Aggregate Initialiser Syntax |
I have set up an online poll:
http://snappoll.com/poll/130337.php
to ask C++ programmers whether they want aggregate initialiser syntax to be
added to the Standard. Here's is how it works:
struct MyAgg { int a; double b; };
class MyClass {
private:
int const arr[3];
MyAgg const agg;
public:
MyClass(int const a,int const b,int const c)
: arr( {a,b,c} ), agg( {b, c * 5.4} )
{
/* Function Body */
}
};
And also:
int *const p = new int[3]({5,4,3});
MyAgg *const p = new MyAgg({3,56.3});
The reason I set up the poll is to possibly demonstrate to the Standards
Committee that programmers feel that this is a fundamental programming
function, and should be provided by the language. (They haven't paid much
attention to the request of late).
--
Frederick Gotham
.
|
|
| User: "Jerry Coffin" |
|
| Title: Re: Aggregate Initialiser Syntax |
12 Sep 2006 08:48:00 PM |
|
|
In article <z0JNg.13658$j7.330106@news.indigo.ie>,
says...
I have set up an online poll:
http://snappoll.com/poll/130337.php
to ask C++ programmers whether they want aggregate initialiser syntax to be
added to the Standard. Here's is how it works:
If you're going to suggest this, wouldn't it make more sense to follow
the same syntax used in C99, as in:
struct { int a[3], b; } w[] =
{ [0].a = {1}, [1].a[0] = 2 };
(from C99, $6.7.8/35).
--
Later,
Jerry.
The universe is a figment of its own imagination.
.
|
|
|
|

|
Related Articles |
|
|