Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 95340 invoked from network); 9 Jul 2008 22:18:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jul 2008 22:18:48 -0000 Received: (qmail 33059 invoked by uid 500); 9 Jul 2008 22:18:46 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 33052 invoked by uid 500); 9 Jul 2008 22:18:46 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 33040 invoked by uid 99); 9 Jul 2008 22:18:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jul 2008 15:18:46 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jul 2008 22:17:54 +0000 Received: from nebula.bco.roguewave.com ([10.70.3.27]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m69MIFsY004841 for ; Wed, 9 Jul 2008 22:18:15 GMT Message-ID: <48753927.1000301@roguewave.com> Date: Wed, 09 Jul 2008 16:18:15 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: Static assertions in tests? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Eric Lemings wrote: > > For compile-time tests, would it be preferable to use a static assertion > or continue using good ol' rw_assert() even for compile-time checks? In > the former case, the test will fail to build and, in the latter case, > the compile-time check will not be easily distinguisable from other > runtime assertions. I would recommend against using one component of the library (static_assert) to test another. The approach taken by existing tests is to verify types and signatures by using them in ways that would make the tests ill-formed if they didn't match the requirements, causing a compiler error. You can see examples of this approach in the 23.vector.cons.cpp test that was just mentioned. Martin