nicolas
06-20-2010, 02:35 AM
First of all, hello everyone.
My first post here is a proposal.
We are presently using IPlug+WDL with the GCC compiler collection on OSX, windows and linux and we are encountering many reports of GCC such as:
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm: In function 'void -[IGraphicsCocoa_v1002 drawRect:](IGraphicsCocoa_v1002*, objc_selector*, NSRect)':
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm:81: warning: taking address of temporary
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm: In function 'void -[IGraphicsCocoa_v1002 mouseDown:](IGraphicsCocoa_v1002*, objc_selector*, NSEvent*)':
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm:104: warning: taking address of temporary
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm:107: warning: taking address of temporary
This happens in many places within IPlug because the following coding style is used:
void g(IRECT* rect, ...);
void f()
{
...
g(&IRECT(0, 0, w, h), ...);
}
Our proposal is to switch to the following style instead:
void g(IRECT const& rect, ...);
void f()
{
g(IRECT(0, 0, w, h), ...);
}
It saves a character per usage, removes a warning, guarantees that the reference is used in a constant context, and should behave exactly the same in terms of performance.
It does, however, requires to change the interface of controls (etc) thus requiring a bit of rewriting for everyone, to remove all those extra & characters.
We can provide a patch against the WDL if desired, and would rather prefer not have to have our own private fork of WDL for such a small thing.
My first post here is a proposal.
We are presently using IPlug+WDL with the GCC compiler collection on OSX, windows and linux and we are encountering many reports of GCC such as:
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm: In function 'void -[IGraphicsCocoa_v1002 drawRect:](IGraphicsCocoa_v1002*, objc_selector*, NSRect)':
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm:81: warning: taking address of temporary
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm: In function 'void -[IGraphicsCocoa_v1002 mouseDown:](IGraphicsCocoa_v1002*, objc_selector*, NSEvent*)':
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm:104: warning: taking address of temporary
/Users/nicolas/Code/ln2/third-party/cockos.com/wdl/IPlug/IGraphicsCocoa.mm:107: warning: taking address of temporary
This happens in many places within IPlug because the following coding style is used:
void g(IRECT* rect, ...);
void f()
{
...
g(&IRECT(0, 0, w, h), ...);
}
Our proposal is to switch to the following style instead:
void g(IRECT const& rect, ...);
void f()
{
g(IRECT(0, 0, w, h), ...);
}
It saves a character per usage, removes a warning, guarantees that the reference is used in a constant context, and should behave exactly the same in terms of performance.
It does, however, requires to change the interface of controls (etc) thus requiring a bit of rewriting for everyone, to remove all those extra & characters.
We can provide a patch against the WDL if desired, and would rather prefer not have to have our own private fork of WDL for such a small thing.