Re: simple conversion from C to C++

From: Charles Banas (uce_at_ftc.gov)
Date: 05/01/04

  • Next message: Scott Allen: "Re: unresolved external symbol/using an external dll"
    Date: Fri, 30 Apr 2004 19:12:29 -0600
    
    

    Christopher Benson-Manica wrote:
    > news.hku.hk <billychu@hkusua.hku.hk> spoke thus:
    >
    > std::cout << n?"-":"" << v;
    >
    > The trinary operator may or may not be advisable here; think about it.
    >

    actually, i've tried that kind of thing before. this is how it should
    be written:

    std::cout << (n?"-":"") << v;

    otherwise, it generates several parse errors in GCC.


  • Next message: Scott Allen: "Re: unresolved external symbol/using an external dll"

    Relevant Pages

    • Re: A situation
      ... prints ' ' with gcc for cygwin. ... I have no idea what the Standard says ... Christopher Benson-Manica | I *should* know what I'm talking about - if I ...
      (comp.lang.c)
    • Re: macros
      ... gcc says that macro ... names must be identifiers... ... Christopher Benson-Manica | I *should* know what I'm talking about - if I ...
      (comp.lang.c)
    • Re: Pointer arithmetic involving NULL pointers
      ... Christopher Benson-Manica spoke thus: ... Or, to post code that's actually legal, ... Maybe I should A) go home, and B) never use the trinary operator in ... Christopher Benson-Manica | I *should* know what I'm talking about - if I ...
      (comp.lang.c)