TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BOB STOUT
from: JONATHAN DE BOYNE POLLARD
date: 1998-02-28 14:19:00
subject: C++ Saveding stuff

 RS>> Of course, C code like this is off topic and should be discussed  in
 RS>> the C echo.
 >> I hope that in ruling on the topicality the moderator bears in mind
 >> that fgets() is a function in the Standard C++ library, defined 
 >> (albeit by reference to ISO IEC 9899) in section 27.8.2 of the 
 >> C++ Standard.
 BS> Of course. Besides, since I'm only filling in for the duration of
 BS> the  election, I'm only cracking down on gross misconduct, not
 BS> mrginal topicality.  
The point that I was making was that fgets() is a part of the the C++ 
language, and it is a mistake to draw the line between C and C++ such that 
fgets() and its like are on only one side of the boundary.  It appears to me 
to be a common misconception amongst C++ novices that one has to throw out 
all of the C Standard library when converting to C++.  Yes, iostreams are in 
many ways more versatile than C streams, but the latter are still a valid 
part of C++.
In discussions on one of the C++ standardisation committees (of which I am a 
member), the view has often been put forward, to help bring this point home, 
that the Standard C++ language has its own, complete, C++ Standard library, 
parts of which, such as fgets(), *resemble* the C Standard library.  
Of course, the problem with this fact being widely unrecognised is that when 
one writes
        if (FILE * f = fopen("file.txt","r")) {
            // ...
            fclose(f) ;
        }
in this echo, and one is then asked to move to the C echo, one moves there 
only to be told that this is incorrect C.  (-:
 ¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.