This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

| Unused Parameters Submitted by

I like to compile my projects with the highest warning levels, and I often find myself with a number of warnings regarding "unreferenced formal parameters". There are other ways of handling it, but I like this one (at least until someone points out something horrible about it):

    template <typename t
    inline void dhUnusedParameter(t p_t){
        p_t;
    }

At the beginning of WinMain I can put:

    dhUnusedParameter(p_prev_instance);

Which not only stops the warning, but also clearly documents that the parameter really isn't being used.
Stay Casual,
Ken
Drunken Hyena
This tip was updated on 06 March 2002.

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.