C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Standardize (BOOST_)STATIC_ASSERT

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Alberto Barbati
Guest





PostPosted: Fri May 06, 2005 8:59 pm    Post subject: Standardize (BOOST_)STATIC_ASSERT Reply with quote



Hi Everybody,

this post has been triggered by Samee Zahur post about error messages,
but I thought it might deserve a separate thread.

The subject says it all: standardizing a facility like
BOOST_STATIC_ASSERT. The advantages of a that are apparent: as a tool,
it has been extensively used, it's simple to implement and a lot of
programmers seem to be using their own equivalent facility when the
don't want to depend on Boost.

I've seen that there is already proposal N1381 about this issue, that
dates back to 2002. Does anyone know what happened to it?

The main strenght and main problem in that proposal is that it looks for
a core language change. If the wording had been just a little different,
a library-based approach could have been allowed, and, who knows?, it
might have been considered for TR1. For example, a very lax wording to
achieve this goal could be the following:

----
The header <static_assert> supplies a single macro STATIC_ASSERT(x). The
macro can be used at namespace scope, at class scope or at namespace
scope. The macro expands in an unspecified way, such that unless x is
integral-constant-expression that evaluates to a value different from 0,
then the code is ill-formed [Note: it is intended that if x is an
integral-constant-expression that evaluates to 0, the diagnostic might
hint the user about an expected compile-time condition that hasn't been
statisfied]
----

Now, I guess it's too late for TR1, but I hope this post may stir some
interest for future enhancements.

Alberto

---
[ 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.jamesd.demon.co.uk/csc/faq.html ]

Back to top
James Dennett
Guest





PostPosted: Sat May 07, 2005 5:02 pm    Post subject: Re: Standardize (BOOST_)STATIC_ASSERT Reply with quote



Alberto Barbati wrote:
Quote:
Hi Everybody,

this post has been triggered by Samee Zahur post about error messages,
but I thought it might deserve a separate thread.

The subject says it all: standardizing a facility like
BOOST_STATIC_ASSERT. The advantages of a that are apparent: as a tool,
it has been extensively used, it's simple to implement and a lot of
programmers seem to be using their own equivalent facility when the
don't want to depend on Boost.

I've seen that there is already proposal N1381 about this issue, that
dates back to 2002. Does anyone know what happened to it?

The main strenght and main problem in that proposal is that it looks for
a core language change. If the wording had been just a little different,
a library-based approach could have been allowed, and, who knows?, it
might have been considered for TR1. For example, a very lax wording to
achieve this goal could be the following:

----
The header <static_assert> supplies a single macro STATIC_ASSERT(x). The
macro can be used at namespace scope, at class scope or at namespace
scope. The macro expands in an unspecified way, such that unless x is
integral-constant-expression that evaluates to a value different from 0,
then the code is ill-formed [Note: it is intended that if x is an
integral-constant-expression that evaluates to 0, the diagnostic might
hint the user about an expected compile-time condition that hasn't been
statisfied]
----

Now, I guess it's too late for TR1, but I hope this post may stir some
interest for future enhancements.

Quoting Pete Becker from another thread yesterday:

[email]tslettebo (AT) hotmail (DOT) com[/email] wrote:

Quote:

There exists a proposal for something similar to this, called
"static_assert"
([url]http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1604.html)[/url],
and from what I understand, it will likely be added to the "working
paper" ("draft standard") for C++0x, so some facility for this will
likely end up in the next version of the standard.


It was approved at the last meeting, and is part of the
not-yet-available latest version of the working draft.

---
[ 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.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Jonathan Turkanis
Guest





PostPosted: Mon May 09, 2005 5:34 pm    Post subject: Re: Standardize (BOOST_)STATIC_ASSERT Reply with quote



Alberto Barbati wrote:

Quote:
The subject says it all: standardizing a facility like
BOOST_STATIC_ASSERT.

I've seen that there is already proposal N1381 about this issue, that
dates back to 2002. Does anyone know what happened to it?

[From the Boost developers list]

Beman Dawes wrote:
Quote:
static_assert was voted into the language by the full committee last
month in Lillehammer.

--Beman

Jonathan



---
[ 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.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.