Re: [Crystal-cvs] SF.net SVN: crystal:[38394] CS/trunk/include/csutil/vararg.h

Eric Sunshine <[email protected]>
Newsgroups gmane.comp.graphics.crystalspace.devel
Message-ID <CAPig+cS10zo+VF3Su8vJpJDE3Z91s8P_LLUDhAZKv5veYdB=JQ@mail.gmail.com>
On Tue, Jul 17, 2012 at 4:00 AM, res <[email protected]> wrote:
> I have a third suggestion:
> Only keep the methods taking a va_list virtual. Keep the ‘real’ vararg methods unconditionally defined, however have (force) them to be inline and non-virtual; they just call the va_list variant.
> 1. Just forwarding to the va_list variant is what most implementations of vararg methods do anyway.
> 2. Having the vararg methods (forced) inline and non-virtual should work around the code generation issues as well - the need for a thunk comes from the method being virtual. The (forced) inline ensures the actual method machine code is generated at it's call site, as it should be for any interface method.
> 3. Being able to call the vararg methods “naturally” is more readable than CS::callv(), compatible with existing code (esp. external code) and less prone to errors – the CS::callv() is easily forgotten, or may seem unnecessary if you're not familiar with the particular llvm shortcoming.
> Thoughts, comments?

In all of these cases, the vararg methods are being invoked via SCF
interfaces, rather than on the implementing object. (That is the
client only deals with an iFoo* rather than with a csFoo.) If we take
this approach, it would mean implementing the non-virtual inline
vararg variation within the SCF interface itself, thus these would no
longer be "pure" interfaces. I don't personally see that as a big
deal, so the approach is certainly feasible.

One minor issue may arise for 3rd-party clients which have already
implemented some of these interfaces. Their overrides of the vararg
methods will no longer get invoked through the SCF interface. However,
as you note, it's fairly unlikely that the vararg version is doing
anything more than delegating to the va_list variation, so it may not
matter in practice.

-- ES

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.