Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++.moderated > #1421

Re: codecvt problem

Message-ID <ispb3v$k32$1@usenet.stanford.edu> (permalink)
Newsgroups comp.lang.c++.moderated
From Seungbeom Kim <musiphil@bawi.org>
Subject Re: codecvt problem
Organization unknown
References <3fe789b8-a729-4623-9e7e-301984e6c053@z13g2000yqg.googlegroups.com> <4DEBC922.2060901@sh.cvut.cz> <isig0g$rj7$1@dont-email.me> <4DED2A8A.1090106@sh.cvut.cz>
Date 2011-06-09 07:01 -0600

Show all headers | View raw


On 2011-06-06 14:31, Vaclav Haisman wrote:
> 
> Jeff Flinn wrote, On 6.6.2011 20:50:
>>
>> Why not mbstate_t mystate = {0};
> Because the last time I tried that I got a warning about bad/wrong
> initializer in case of mbstate_t being an int.

It's not "wrong", because the C++ standard guarantees that:

"If T is a scalar type, then a declaration of the form
    T x = { a };
is equivalent to
    T x = a;
" (8.5/13), as well as the C standard:

"The initializer for a scalar shall be a single expression,
optionally enclosed in braces." (6.7.8/11)

Being considered "bad" (in terms of style) is a different matter, though.
(But what alternatives do you have, especially in C? So far, only the
file scope variable method, which is not very elegant.)

-- 
Seungbeom Kim


      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

Back to comp.lang.c++.moderated | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

codecvt problem  Rafał Moniuszko <rafal.lists@gmail.com> - 2011-06-05 07:25 -0600
  Re: codecvt problem Vaclav Haisman <v.haisman@sh.cvut.cz> - 2011-06-05 21:41 -0600
    Re: codecvt problem  Jeff Flinn <TriumphSprint2000@hotmail.com> - 2011-06-06 12:50 -0600
      Re: codecvt problem Vaclav Haisman <v.haisman@sh.cvut.cz> - 2011-06-06 15:31 -0600
        Re: codecvt problem  Martin Bonner <martinfrompi@yahoo.co.uk> - 2011-06-08 02:06 -0600
          Re: codecvt problem  Vaclav Haisman <v.haisman@sh.cvut.cz> - 2011-06-08 17:24 -0600
            Re: codecvt problem  Seungbeom Kim <musiphil@bawi.org> - 2011-06-09 07:02 -0600
              Re: codecvt problem Vaclav Haisman <v.haisman@sh.cvut.cz> - 2011-06-16 17:04 -0600
                Re: codecvt problem Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-06-17 06:42 -0600
                Re: codecvt problem Seungbeom Kim <musiphil@bawi.org> - 2011-06-18 07:38 -0600
                Re: codecvt problem Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-06-20 13:16 -0600
                Re: codecvt problem Seungbeom Kim <musiphil@bawi.org> - 2011-06-23 14:42 -0600
        Re: codecvt problem  Seungbeom Kim <musiphil@bawi.org> - 2011-06-09 07:01 -0600
      Re: codecvt problem Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-06-06 15:31 -0600
        Re: codecvt problem Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-06-07 03:07 -0600
          Re: codecvt problem  Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-06-07 10:31 -0600
  Re: codecvt problem  Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-06-06 12:47 -0600

csiph-web