Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Many Features Proposed For C++14

  1. #11
    Join Date
    Oct 2007
    Posts
    31

    Default How about designated initializers?

    They've been in C since C99. Maybe 15 years is enough time for useful features to make it from C into C++?

  2. #12
    Join Date
    Aug 2012
    Location
    Pennsylvania, United States
    Posts
    1,858

    Default

    Quote Originally Posted by brouhaha View Post
    They've been in C since C99. Maybe 15 years is enough time for useful features to make it from C into C++?
    C++ includes all of C, its just a matter of whether or not its being used.

  3. #13
    Join Date
    Mar 2011
    Location
    Canada
    Posts
    94

    Default

    Quote Originally Posted by Ericg View Post
    C++ includes all of C, its just a matter of whether or not its being used.
    C++ doesn't include all of C, it includes (almost) all of C89 and some cherry picked features from C99. Designated initializers are non-standard in C++ and there are minor incompatibilities like 'c' being a char literal instead of an int and explicit casts being required from void *.

  4. #14
    Join Date
    Dec 2012
    Posts
    498

    Default

    Quote Originally Posted by strcat View Post
    C++ doesn't include all of C, it includes (almost) all of C89 and some cherry picked features from C99. Designated initializers are non-standard in C++ and there are minor incompatibilities like 'c' being a char literal instead of an int and explicit casts being required from void *.
    In defense of C++ on the char thing (though it isn't much of a defense) any reasonable modern language would be implementing chars as code points which, by being variable size, can't be contained in a fixed 8 bit integral value (does the cast return 2 bytes? where do you put / refer to those? Does it just return a short? What if its a 3 byte code point?) Though, C++ still uses ASCII raw chars and requires writing nonsense like u8"asdfpattie" with auto types or wchar_t nonsense (char16_t, char32_t... bleh).

    C doesn't have anything close to unicode support, though. It says something that Rust / Go, the two "newer" popular native languages are both only unicode.

  5. #15
    Join Date
    Mar 2011
    Location
    Canada
    Posts
    94

    Default

    Quote Originally Posted by zanny View Post
    In defense of C++ on the char thing (though it isn't much of a defense) any reasonable modern language would be implementing chars as code points which, by being variable size, can't be contained in a fixed 8 bit integral value (does the cast return 2 bytes? where do you put / refer to those? Does it just return a short? What if its a 3 byte code point?) Though, C++ still uses ASCII raw chars and requires writing nonsense like u8"asdfpattie" with auto types or wchar_t nonsense (char16_t, char32_t... bleh).

    C doesn't have anything close to unicode support, though. It says something that Rust / Go, the two "newer" popular native languages are both only unicode.
    It's actually an int in C, and a char in C++; I get the impression you interpreted it the other way. I don't know why it's an int in C, but the rationale for breaking compatibility in C++ was to avoid confusing people by calling an int function overload with a literal like 'a' . In C, it's not nearly as noticeable.

  6. #16
    Join Date
    Oct 2009
    Location
    West Jordan, Utah, USA
    Posts
    53

    Default rMORE CONCURRENCY

    The thread safe deque would have my vote.
    I've also recently been bitten by the fact that (in g++) the default hashing template used by map and unordered_map will bomb with mutiple threads... Come on guys, what possible reason could a hashing function have for being anything but reentrant?!

    I'd like to see al the std containers have thread safe versions or optional thread safety at compile time.

  7. #17
    Join Date
    Oct 2012
    Location
    Washington State
    Posts
    404

    Default

    Quote Originally Posted by zanny View Post
    In defense of C++ on the char thing (though it isn't much of a defense) any reasonable modern language would be implementing chars as code points which, by being variable size, can't be contained in a fixed 8 bit integral value (does the cast return 2 bytes? where do you put / refer to those? Does it just return a short? What if its a 3 byte code point?) Though, C++ still uses ASCII raw chars and requires writing nonsense like u8"asdfpattie" with auto types or wchar_t nonsense (char16_t, char32_t... bleh).

    C doesn't have anything close to unicode support, though. It says something that Rust / Go, the two "newer" popular native languages are both only unicode.
    That's what C11 includes.

  8. #18
    Join Date
    Feb 2008
    Location
    Linuxland
    Posts
    4,967

    Default

    Quote Originally Posted by bnolsen View Post
    having written high performance massively parallel software my experience with openMP is quite unimpressive. Gains are typically quite sub linear, more log-like. It's okay as a stop gap for trying to upgrade old non thread safe software. IMHO new vector unit technology can be dramatically faster. In my experience there are 2 levels of parallelization: instruction level. best left to vectorization techniques, and task level parallelism which is an issue of software design and not a coding problem.
    I agree with the others, I've gotten good results with OpenMP. The latest one got 5.5x throughput on 6 cores, close to linear.

  9. #19
    Join Date
    Nov 2012
    Posts
    33

    Default

    Quote Originally Posted by brouhaha View Post
    They've been in C since C99. Maybe 15 years is enough time for useful features to make it from C into C++?
    They aren't included simply because that's not how you initialize structs/classes in idiomatic C++.
    That's what constructors are for.

    Granted, if you must work with C structs to which definitions you got no access for, it's a bit of a pain.

  10. #20
    Join Date
    Jul 2011
    Posts
    102

    Default Re

    Quote Originally Posted by Ericg View Post
    C++ includes all of C, its just a matter of whether or not its being used.
    Don't tell a C and/or C++ programmer this thing, some people get really angry when you confuse this things.
    There are A Lot of things that C++ doesn't have from C, it is often not observed because compilers implement them as "extensions".
    Basic things are: char differences, restrict keyword, register keyword...
    There are a lot of things, but I doubt you are interested in them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •