Announcement

Collapse
No announcement yet.

GCC Developers Look At Transitioning Their Codebase To C++11

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

  • #51
    Originally posted by tildearrow View Post
    I only use C arrays for fixed-size ones or when I really desire speed.
    c arrays decay to pointers. it's advisable to forbid constant size c arrays
    Originally posted by tildearrow View Post
    ...modules? Is this a replacement to libraries, or something like Java packages?
    replacement to headers(preprocessor text inclusion)

    Comment


    • #52
      Originally posted by pal666 View Post
      [Rust] isn't portable, it's llvm only. and that is c++14 already btw
      A glass 1/100th empty (99/100 full);
      https://forge.rust-lang.org/release/...m-support.html

      Comment


      • #53
        Originally posted by carewolf View Post
        That is what all big companies use. Proven industry standards that work across all compilers so they are not tied to specific crap.
        is microsoft big enough company for you? most of c++17 works across all compilers that matter

        Comment


        • #54
          Originally posted by elatllat View Post
          A glass 1/100th empty (99/100 full);
          you missed the part where they are concerned with c++14 portability and you have c++14 when you have rust

          Comment


          • #55
            Originally posted by carewolf View Post
            C++20 isn't the latest and greatest. It is still future tech, since the none of big features are yet implemented in a non-experimental way by any compiler.
            it's future tech because it was not ratified yet

            Comment


            • #56
              Originally posted by coder View Post
              Okay, so you mean manual deallocations. You can still use-after-free, with std::unique_ptr<>,
              not via this unique_ptr
              Originally posted by coder View Post
              If I'm using an initializer list, then std::array<> forces me to redundantly specify the length as a template parameter.
              Code:
              int vals[] = { 1, 2, 3 };
              only if you are using obsolete standard. c++17 brings https://en.cppreference.com/w/cpp/la...ment_deduction so you can write
              Code:
              [COLOR=#000000]std::array vals { [/COLOR][COLOR=#09885a]1[/COLOR][COLOR=#000000], [/COLOR][COLOR=#09885a]2[/COLOR][COLOR=#000000], [/COLOR][COLOR=#09885a]3[/COLOR][COLOR=#000000] };[/COLOR]
              you see, now i can argue that c array forces you to redundantly specify int as its element type

              Comment


              • #57
                Originally posted by coder View Post
                Anyway, if you might need to erase, I think your best options are:
                • use iterators
                • iterate by index (if randomly-accessible container)
                i'd start with https://en.cppreference.com/w/cpp/ex...ector/erase_if

                Comment


                • #58
                  Originally posted by coder View Post
                  Heh, you'll never be truly rid of macros. Just try writing assert() without using macros, to give one use case.
                  just wait for contracts in c++23 (i feel pity for people who get them only in 2028. i feel pity we aren't going to get them in c++20)
                  Last edited by pal666; 01 October 2019, 01:09 PM.

                  Comment


                  • #59
                    Originally posted by cynical View Post
                    As a Lisp user, my mind boggles at how you C++ programmers survived without lambda expressions.
                    as a c++ user my mind boggles at how you scheme programmers survived without static typing
                    Originally posted by cynical View Post
                    For people who are curious, they are just unnamed procedures that evaluate to a value. (aka function expressions)
                    in c++ they are certainly not procedures. they are unnamed class objects with overloaded operator() (functors)
                    Originally posted by cynical View Post
                    JavaScript also has a really fantastic syntax for them.
                    Code:
                    const square = (x) => x * x
                    c++ had proposal with similar syntax, it was rejected due to technical issues. you see, c++ committee has to design sane language, unlike javascript. but maybe someone comes with improved proposal in fufure
                    Originally posted by cynical View Post
                    What do you mean? That book was fantastic! There is a similar tome for Java (I think it’s just called Effective Java) that is equally good, but reminds me precisely why I’d rather use Clojure than Java.
                    all cool kids are already switched to kotlin

                    Comment


                    • #60
                      Originally posted by tildearrow View Post
                      So there is no way to do it using the easily-readable syntax? Oh....
                      there is a way to pass your loop body as predicate to erase_if()
                      Originally posted by tildearrow View Post
                      Because I use clock_gettime since I think it takes less time to execute.
                      chrono also uses clock_gettime https://github.com/gcc-mirror/gcc/bl.../chrono.cc#L88

                      Comment

                      Working...
                      X