Search Results

Search found 4 results on 1 pages for 'xtofl'.

Page 1/1 | 1 

  • False sense of security with `snprintf_s`

    - by xtofl
    MSVC's "secure" sprintf funcions have a template version that 'knows' the size of the target buffer. However, this code happily paints 567890 over the stack after the end of bytes... char bytes[5]; _snprintf_s( bytes, _TRUNCATE, "%s", "1234567890" ); Any idea what I do wrong, or is this a known bug? (I'm working in VS2005 - didn't test in 2008 or 2010)

    Read the article

  • php numbers: assert( 1.0 < 2.0 )

    - by xtofl
    How can this <?php assert( 1.0 < 2.0 ); ?> result in Warning: assert() [function.assert]: Assertion failed in C:\Program Files (x86)\wamp\www\test.php on line 2 Edit: depending on the file I put this code in, 1.0 < 2.0 evaluates to false or true.

    Read the article

  • XML allows for external entities; what about XHTML?

    - by xtofl
    This question about web page 'inclusion' triggered my curiosity. The XML allows you to specify a reference to an 'external' portion. Can you do the same in XHTML, then? XML example: <!ENTITY foo SYSTEM "http://www.mydomain.com/logo.gif" NDATA GIF87A> ... <SOMETHING>&foo;</SOMETHING>

    Read the article

  • Friendly way to override `const`-overloaded member function?

    - by xtofl
    Given a base class class A { int i; public: int& f(){ return i;} const int& f() const { return i;} }; And a sub class class ConstA : private A { public: const int& f() const { return A::f(); } }; Is there a wrist-friendly way to access the ConstA::f method on a non-const variable? ConstA ca; int i = ca.f(); // compile error: int& A::f() is not accessible since A is privately inherited int j = static_cast<const ConstA&>(ca).f(); // this works, but it hurts a little... Or is it so ugly since hiding A::f generally is a bad idea, violating the Liskov Substitution Principle: any subclass of A must at least be capable of all A's functionality? void set( A& a, int i ) { a.f() = i; } class ConstA2 : public A { private: int& f(){ return A::f(); } }; ConstA2 ca2; set( ca2, 1 ); (Note: this question popped up while thinking about this question)

    Read the article

1