Re: #define vs. const
From: Chris Theis (Christian.Theis_at_nospam.cern.ch)
Date: 09/19/04
- Next message: John Harrison: "Re: structs for data transfer?"
- Previous message: Dave Townsend: "Re: C++ Objects, Stack or Heap? [Noob question]"
- In reply to: Ioannis Vranos: "Re: #define vs. const"
- Next in thread: Ioannis Vranos: "Re: #define vs. const"
- Reply: Ioannis Vranos: "Re: #define vs. const"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 19 Sep 2004 21:08:56 +0200
"Ioannis Vranos" <ivr@guesswh.at.grad.com> schrieb im Newsbeitrag
news:cikdiv$1h2o$1@ulysses.noc.ntua.gr...
> Chris Theis wrote:
[SNIP]
>
> In most compilers inclusion guards can be replaced with #pragma
> directives. Like
>
> #pragma once
>
Yes, that's true but still compiler dependent.
>
>
> > or of some more nifty uses
> > like in compile time asserts with more informative error messages. I
simply
> > donŽt know how youŽd achieve it without a macro.
> >
> > template <bool x> struct StaticAssert {
> > StaticAssert(...);
> > };
> > template <> struct StaticAssert<false>{};
> > #define COMPILE_ASSERT( Expr, Msg ) \
> > { \
> > class ERROR_##Msg {}; \
> > (void)sizeof( StaticAssert<(Expr) != 0>(( ERROR_##Msg()))); \
> > }
>
>
> With an array of pointers to functions or objects may be?
>
Hmm, could you please elaborate on that. I don't quite see how to gain
informative error messages from compile-time (!) asserts with pointers to
functions or objects. I'd be really interested how to do this, so I'd
appreciate an example.
Best regards
Chris
- Next message: John Harrison: "Re: structs for data transfer?"
- Previous message: Dave Townsend: "Re: C++ Objects, Stack or Heap? [Noob question]"
- In reply to: Ioannis Vranos: "Re: #define vs. const"
- Next in thread: Ioannis Vranos: "Re: #define vs. const"
- Reply: Ioannis Vranos: "Re: #define vs. const"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|