Announcement

Collapse
No announcement yet.

Many Features Proposed For C++14

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    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++?

    Comment


    • #12
      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.
      All opinions are my own not those of my employer if you know who they are.

      Comment


      • #13
        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 *.

        Comment


        • #14
          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.

          Comment


          • #15
            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.

            Comment


            • #16
              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.

              Comment


              • #17
                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.

                Comment


                • #18
                  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.

                  Comment


                  • #19
                    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.

                    Comment


                    • #20
                      Re

                      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.

                      Comment

                      Working...
                      X