On Fri, May 1, 2009 at 1:27 PM, Adam Langley <a...@chromium.org> wrote:

> On Fri, May 1, 2009 at 12:53 PM, Jeremy Orlow <jor...@google.com> wrote:
> > I'm still kind of new here, so forgive me if this is a silly question,
> but
> > why do this with a define and not an template function?
>
> One could imagine a template function:
>
> template<typename T>
> T handle_eintr(T &a) {
>   ..
> }
>
> But when using it as:
>
> handle_eintr(close(fd));
>
> How would one trigger close(fd) to be possibly evalulated multiple
> times? I think that's the one thing which precludes a template
> function sadly.


Doh.  Completely forgot about that.  You'd have to do some silliness like
have a template for each number of parameters to the system call.  Obviously
the define's the better solution in this case.  :-)

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to