Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    95fb0249
    LLSD-14: Move LLSD::(outstanding|allocation)Count() to free functions. · 95fb0249
    Nat Goodspeed authored
    Free functions can be unconditionally compiled into the .o file, but
    conditionally hidden in the header file. Static class methods don't have that
    flexibility: without a declaration in the header file, you can't compile a
    function definition in the .cpp file. That makes it awkward to use the same
    llcommon build for production and for unit tests.
    Why make the function declarations conditional at all? These are debugging
    functions. They break the abstraction, they peek under the covers. Production
    code should not use them. Making them conditional on an #ifdef symbol in the
    unit-test source file means the compiler would reject any use by production
    code. Put differently, it allows us to assert with confidence that only unit
    tests do use them.
    Put new free functions in (lowercase) llsd namespace so as not to clutter
    global namespace.
    Tweak the one known consumer (llsd_new_tut.cpp) accordingly.
    95fb0249
    History
    LLSD-14: Move LLSD::(outstanding|allocation)Count() to free functions.
    Nat Goodspeed authored
    Free functions can be unconditionally compiled into the .o file, but
    conditionally hidden in the header file. Static class methods don't have that
    flexibility: without a declaration in the header file, you can't compile a
    function definition in the .cpp file. That makes it awkward to use the same
    llcommon build for production and for unit tests.
    Why make the function declarations conditional at all? These are debugging
    functions. They break the abstraction, they peek under the covers. Production
    code should not use them. Making them conditional on an #ifdef symbol in the
    unit-test source file means the compiler would reject any use by production
    code. Put differently, it allows us to assert with confidence that only unit
    tests do use them.
    Put new free functions in (lowercase) llsd namespace so as not to clutter
    global namespace.
    Tweak the one known consumer (llsd_new_tut.cpp) accordingly.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.