Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-14004

Make astshim compliant with the -pedantic compiler flag

    XMLWordPrintable

    Details

      Description

      astshim has a few C++ violations that are exposed using the -pedantic flag with the C++ compiler. Fix them.

        Attachments

          Issue Links

            Activity

            Hide
            rowen Russell Owen added a comment -

            The only pedantic error was use of variable-length char *. std::string will handle this in C++17 but meanwhile I added a small utility class to provide an RAII version of a char *.

            I also took the liberty of fixing a few PEP8 violations and enabling auto PEP8 checking.

            Show
            rowen Russell Owen added a comment - The only pedantic error was use of variable-length char *. std::string will handle this in C++17 but meanwhile I added a small utility class to provide an RAII version of a char * . I also took the liberty of fixing a few PEP8 violations and enabling auto PEP8 checking.
            Hide
            jbosch Jim Bosch added a comment -

            I do think the RAII object needs to be adjusted, but it may be best to just drop it in favor of unique_ptr - it turns out you don't even need a custom deleter for that.

            Show
            jbosch Jim Bosch added a comment - I do think the RAII object needs to be adjusted, but it may be best to just drop it in favor of unique_ptr - it turns out you don't even need a custom deleter for that.
            Hide
            rowen Russell Owen added a comment -

            Sounds good. Can you please tell me how to compile with -pedantic? I didn't try it.

            Show
            rowen Russell Owen added a comment - Sounds good. Can you please tell me how to compile with -pedantic ? I didn't try it.
            Hide
            jbosch Jim Bosch added a comment -

            Easiest thing to do is just use branch tickets/DM-13983 of sconsUtils.

            Show
            jbosch Jim Bosch added a comment - Easiest thing to do is just use branch tickets/ DM-13983 of sconsUtils.
            Hide
            rowen Russell Owen added a comment - - edited

            Thank you for the suggestion to use unique_ptr. I did that and it all seems to work. I was able to build using -pedantic.

            Please have another look and make sure I used unique_ptr correctly. One question I had is whether it is better to use cstr.get() + i*eltLen (which is what I did) or &cstr[i*eltLen] to access a pointer to an element cstr, a char[] held by a std::unique_ptr

            Show
            rowen Russell Owen added a comment - - edited Thank you for the suggestion to use unique_ptr. I did that and it all seems to work. I was able to build using -pedantic . Please have another look and make sure I used unique_ptr correctly. One question I had is whether it is better to use cstr.get() + i*eltLen (which is what I did) or &cstr [i*eltLen] to access a pointer to an element cstr , a char[] held by a std::unique_ptr
            Hide
            jbosch Jim Bosch added a comment -

            Looks good, thanks for taking care of this! (Now I need to go fix ndarray).

            Show
            jbosch Jim Bosch added a comment - Looks good, thanks for taking care of this! (Now I need to go fix ndarray).
            Hide
            rowen Russell Owen added a comment -

            Thank you for the helpful review.

            Show
            rowen Russell Owen added a comment - Thank you for the helpful review.

              People

              Assignee:
              rowen Russell Owen
              Reporter:
              rowen Russell Owen
              Reviewers:
              Jim Bosch
              Watchers:
              Jim Bosch, Russell Owen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.