List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:July 5 2007 11:59pm
Subject:Re: Bug: char[]s not escaped
View as plain text  
Jonathan Wakely wrote:
> On 02/07/07, Andrew Sayers <andrew-mysqlpp@stripped> wrote:
>>
>> +inline std::ostream& operator <<(quote_type1 o,
>> +               char in[])
>> +{
>> +       return operator <<(o, static_cast<const char*
> const&>(in));
>> +}
> 
> Personally I would use simply static_cast<cont char*>(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.
Thread
Bug: char[]s not escapedAndrew Sayers2 Jul
  • Re: Bug: char[]s not escapedAndrew Sayers2 Jul
    • Re: Bug: char[]s not escapedWarren Young2 Jul
    • Re: Bug: char[]s not escapedJonathan Wakely4 Jul
      • Re: Bug: char[]s not escapedWarren Young6 Jul
        • Re: Bug: char[]s not escapedJonathan Wakely7 Jul