From: Warren Young Date: July 5 2007 11:59pm Subject: Re: Bug: char[]s not escaped List-Archive: http://lists.mysql.com/plusplus/6741 Message-Id: <468D85FC.8050001@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jonathan Wakely wrote: > On 02/07/07, Andrew Sayers wrote: >> >> +inline std::ostream& operator <<(quote_type1 o, >> + char in[]) >> +{ >> + return operator <<(o, static_cast(in)); >> +} > > Personally I would use simply static_cast(in) if doing that. Go try it. Andrew and I both know what will happen, but it seems you need a demonstration. >:) When you're done, you will understand the lament in my previous message in this thread. > The assembly code shows five instructions You're trying to save three assembly instructions in a process that moves data from a hard disk to a remote program over an IPC channel in an intermediate representation, up through two layers of libraries, to a program that will reformat that data via the C++ IOStreams library? Have you any idea how many clock cycles elapsed in all that? 3 clock cycles is so small by comparison that you should express the ratio on a logarithmic scale, rather than as a percentage. If three instructions matters to you, you should be using flat files of fixed-length C structs instead of a relational database. That's the only way you'll have any hope of being able to measure a meaningful performance difference.