POV-Ray : Newsgroups : povray.off-topic : Unix shell : Re: Unix shell Server Time
3 Sep 2024 21:18:46 EDT (-0400)
  Re: Unix shell  
From: Warp
Date: 1 Feb 2011 09:29:09
Message: <4d4818b5@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Or, look at it a different way, if you're *really* interested in pursuing 
> understanding what I'm saying:  Why do you #include stdio in your program?
> As you said, it's part of the standard. You can't change it without breaking 
> lots of programs. Also, you can't pick a different function to be called 
> "printf" without breaking any library that expects "printf" to mean the one 
> from stdio. (I.e., C's linker has a flat namespace, so if *anyone* includes 
> stdio, then the symbols from stdio will preclude using that name anywhere 
> else to mean something different.)  So why does one have to recompile 
> stdio.h every time you compile a program?

> I know the *technical* reason, as in "because that's how C works." I'm 
> asking you to try to understand why working that way is not as good as 
> simply telling the compiler you're using the standard library and symbols 
> come from there. You see the fact that you're recompiling bits and pieces of 
> the standard-mandated standard libraries (that you correctly acknowledge 
> can't be changed anyway) every single time you compile your program, yes? 
> And that doesn't sound like a strange idea?

  Let's take a better example: Every time I want to use std::vector,
I have to #include <vector> in the source file where I want to do so.

  Is there any advantage to this?

  You could move all standard (non-templated) functions into the core
features of the language rather than them being declared in header files,
and it would still work ok. OTOH, is there a huge disadvantage in having
to include the files other than the trouble of having to write the
#include lines?

-- 
                                                          - Warp


Post a reply to this message

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