TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JAMIE KOWINSKY
from: JONATHAN DE BOYNE POLLARD
date: 1997-10-21 00:07:00
subject: Char[] Strings

 JK> For example, is cin << somestring; safe? 
Yes, as long as the string is properly NUL-terminated.  It won't do much, 
however, since all output to an istream such as cin will cause an error.  
        
 JK> if an array has 3 elements (0-3) I cannot store "the" as there will
 JK> be no null character, 
If an array has 3 elements, they will be numbered 0 to 2, not 0 to 3.  
Otherwise, you are correct.
 ¯ JdeBP ®
--- FleetStreet 1.19 NR
 BP> struct base {
 BP>     int f();
 BP>     int f(int,int);
 BP> } ;
 BP> struct derived : public base {
 BP>     int f();
 BP> };
 BP> derived a ;
 BP> a.f(1,2) ;                // ERROR
 BP> [Redefining] f() and inheriting parent's f(int,int) without 
 BP> additional problems would be [more] intuitive, and make no more 
 BP> work to the compiler.
Yes it would.  It would complicate name lookup enormously, since it would 
have to perform overload resolution across multiple scopes simultaneously.  
As the current language rules stand, name lookup occurs first, finding the 
`f' in the scope of class derived, and *then* overload resolution occurs, in 
the scope of the name that is found.
 ¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
* 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™.