[Dune] [Dune-Commit] dune-common r6255 - trunk/dune/common

Jö Fahlke jorrit at jorrit.de
Sun Nov 28 18:22:03 CET 2010


Am Sun, 28. Nov 2010, 18:12:05 +0100 schrieb Christian Engwer:
> > >          /** \brief Make a pyramid */
> > > -        void makePyramid() {basicType_ = pyramid;  dim_ = 3;}
> > > +        void makePyramid() {
> > > +            none_  = false;
> > > +            dim_ = 3;
> > > +            topologyId_ = 0b0011;
> > 
> > Binary literals are a gcc-extension; they are neither in C99, nor C++ 2003,
> > nor C++0x.  They fail for instance with g++-4.1.  I have no idea how likely
> > they are to work with non-gcc compilers.
> 
> f***... so we have to get the back to the unreadable binary shifting
> or hex-literals
> :-(

Or something like

  static const unsigned pyramidTopologyId = parse_binary("0011");
  topologyId_ = pyramidTopologyId;

for a suitable function parse_binary().  Not very nice either.

With C++0x you could use user-defined literals, something along the lines of:

  template <char...>
  unsigned operator "" b() {...}

  [...]

  topologyId_ = 0011b;

That too excludes g++-4.1, however.

Bye,
Jö.

-- 
Wenn wir tatsächlich denken würden, und sei es bloß an uns selber,
wäre die Welt schon viel besser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20101128/9304aad8/attachment.sig>


More information about the Dune mailing list