POV-Ray : Newsgroups : povray.off-topic : All your radix are belong to us! : Re: All your radix are belong to us! Server Time
29 Jul 2024 22:27:56 EDT (-0400)
  Re: All your radix are belong to us!  
From: Warp
Date: 1 Aug 2011 17:50:20
Message: <4e371f9c@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> they warn you if you pass 
> the wrong types to printf with a literal formatting argument (which is why 
> the iostream argument that it's better because it's strongly typed never 
> made much sense to me)

  It depends on the compiler. Some compilers, especially the slightly older
ones, don't make such checks.

  Of course the major problem with the printf-style of I/O is that it breaks
abstraction, even in C. You just have to do something this to get a problem:

typedef int MySpecialInt;

...

void foo(MySpecialInt i)
{
    printf("The parameter was: %???\n", i);
}

  What to put as a format? Even if you put "%i" and have it work ok, it
breaks the abstraction of MySpecialInt because now you can't change it
without breaking the printf. Obviously the C++ streams have no such
problem.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.