[OT] Re: Why Is Escaping Data Considered So Magical?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Jun 29 20:25:11 EDT 2010


In message <mailman.2332.1277785175.32709.python-list at python.org>, Kushal 
Kumaran wrote:

> On Tue, Jun 29, 2010 at 5:56 AM, Lawrence D'Oliveiro
> <ldo at geek-central.gen.new_zealand> wrote:
>
>> Why does this work, then:
>>
>> ldo at theon:hack> cat test.c
>> #include <stdio.h>
>>
>> int main(int argc, char ** argv)
>>  {
>>    char buf[512];
>>    const int a = 2, b = 3;
>>    snprintf(&buf, sizeof buf, "%d + %d = %d\n", a, b, a + b);
>>    fprintf(stdout, buf);
>>    return
>>        0;
>>  } /*main*/
>> ldo at theon:hack> ./test
>> 2 + 3 = 5
> 
> By accident.

I have yet to find an architecture or C compiler where it DOESN’T work.

Feel free to try and prove me wrong.



More information about the Python-list mailing list