User Activity

  • Posted a comment on discussion General Discussion on cppcheck

    My objects that are created and destroyed in one statement always do something required and it is often quite a lot. I've found it can be easier to debug when the debugger can use an identifier and there are more statements to put breakpoints on. Your example is probably an exceptional case and it given at C++ Core Guidelines somewhere.

  • Posted a comment on discussion General Discussion on cppcheck

    I have some objects without names that are created and destroyed with one statement. This minimises the objects lifetime. CPPCheck tells me "Instance of 'xxx' object is destroyed immediately." as a style warning. I see this as good style.

  • Posted a comment on discussion General Discussion on cppcheck

    I find that many potentialy inlined functions are defined in a .cpp file and called from another translation unit.

  • Posted a comment on discussion General Discussion on cppcheck

    I can't see a negative side to it other than too much inlining. Someone thought it was worthwhile making constexpr functions implicitly declared inline.

  • Posted a comment on discussion General Discussion on cppcheck

    To use inline on small functions is recommended by C++ Core Guidelines F5. It says inline isn't required for function templates but unless they are defined within a class definition they are not inplicitly declared inline.

  • Posted a comment on discussion General Discussion on cppcheck

    Does cppcheck issue a warning for small functions that are not declared inline? I can't remember ever seeing one. It is an optimisation that has existed for a long time but is easily neglected. Many functions now are declared with constexpr which makes an implicit inline declaration from C++11.

  • Posted a comment on discussion General Discussion on cppcheck

    I wasn't aware that noexcept was affecting this. It is interesting and possibly useful that the constructor can be declared noexcept since the argument object would throw during its construction before the construction of the NameContainer which now won't throw.

  • Posted a comment on discussion General Discussion on cppcheck

    class NameContainer { public: explicit NameContainer(std::string /in file name/) noexcept; private: std::string inName_; }; NameContainer::NameContainer(std::string inName) noexcept : inName_(std::move(inName)) { }

View All

Personal Data

Username:
fraserross
Joined:
2009-07-27 17:04:35

Projects

  • No projects to display.

Personal Tools