Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 25639 invoked by uid 6000); 11 Apr 1998 20:21:09 -0000 Received: (qmail 25632 invoked from network); 11 Apr 1998 20:21:05 -0000 Received: from eastwood.aldigital.algroup.co.uk (194.128.162.193) by taz.hyperreal.org with SMTP; 11 Apr 1998 20:21:05 -0000 Received: from freeby.ben.algroup.co.uk (freeby.ben.algroup.co.uk [193.133.15.6]) by eastwood.aldigital.algroup.co.uk (8.6.12/8.6.12) with ESMTP id UAA22209 for ; Sat, 11 Apr 1998 20:20:13 GMT Received: from algroup.co.uk (naughty.ben.algroup.co.uk [193.133.15.107]) by freeby.ben.algroup.co.uk (8.6.12/8.6.12) with ESMTP id VAA16217 for ; Sat, 11 Apr 1998 21:20:07 +0100 Message-ID: <352FD060.B5761480@algroup.co.uk> Date: Sat, 11 Apr 1998 21:19:44 +0100 From: Ben Laurie Organization: A.L. Digital Ltd. X-Mailer: Mozilla 4.04 [en] (WinNT; I) MIME-Version: 1.0 To: new-httpd@apache.org Subject: Re: [PATCH] Resolve BUILD warnings under ULTRIX/mips (take 3) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Dean Gaudet wrote: > > And btw, as long as you're using templates, which are non-portable, Phooey. ANSI C is non-portable. So what? > I > might as well give a C example that accomplishes exactly what you did: Not exactly. It does rely on you getting the function right (static_cast_unsigned), whereas static_cast<> in C++ is inherently safe. Admittedly if you only have to write it once you are more likely to get it right. Also, you have to specify the source _and_ destination types with this technique, which will, presumably, lead to a lot of functions in the end... > unsigned inline static_cast_unsigned(int x) { return (unsigned)x; } > > unsigned foo(void) > { > return static_cast_unsigned(foo); > } Hmmm ... so typing static_cast<> is "so much extra crap" in C++, but 10 times as much in C is acceptable. Talk about double standards! > This works fine for generating errors on gcc. And a #define version of > static_cast_unsigned could be used everywhere else. Errr? A #define version gets you back to where you were in the first place. Or have I misunderstood? > Thanks for the tip. You're welcome. Cheers, Ben. -- Ben Laurie |Phone: +44 (181) 735 0686| Apache Group member Freelance Consultant |Fax: +44 (181) 735 0689|http://www.apache.org and Technical Director|Email: ben@algroup.co.uk | A.L. Digital Ltd, |Apache-SSL author http://www.apache-ssl.org/ London, England. |"Apache: TDG" http://www.ora.com/catalog/apache