News for hackers. Stuff that matters.
Re:C++: A language for next generation web apps by tedunangst on Tuesday January 26, 2010 @07:57PM (#1079432)

    1     wchar_t *
    2     utf2wide(const char *utf)
    3     {
    4        size_t len;
    5        wchar_t *wide;
    6        len = mbstowcs(NULL, utf, 0);
    7        wide = malloc(sizeof(*wide) * (len + 1));
    8        mbstowcs(wide, utf, len);
    9        return wide;
    10     }
Re:C++: A language for next generation web apps by gfodor on Tuesday January 26, 2010 @08:16PM (#1079475)
That is definitely the most to-the-point response I've ever seen.
Re:C++: A language for next generation web apps by st3fan on Wednesday January 27, 2010 @07:36AM (#1080356)
Because the result of malloc is not checked, it can take the whole web server down if it returns NULL. Which can happen.
Re:C++: A language for next generation web apps by tjake on Tuesday January 26, 2010 @11:19PM (#1079753)
thats C not C++. geesh :P
Re:C++: A language for next generation web apps by jrockway on Wednesday January 27, 2010 @12:12AM (#1079825)
I hear C++ can call C functions these days.
Re:C++: A language for next generation web apps by invisible on Wednesday January 27, 2010 @12:50AM (#1079876)
It's amazing the bridges technology can create these days. cough