home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!know!cass.ma02.bull.com!think.com!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!natinst.com!news.dell.com!math.utexas.edu!ut-emx!emx.cc.utexas.edu
- From: jamshid@emx.cc.utexas.edu (Jamshid Afshar)
- Newsgroups: comp.std.c++
- Subject: Can Standard C functions be overloaded?
- Message-ID: <83359@ut-emx.uucp>
- Date: 11 Nov 92 02:14:41 GMT
- Sender: jamshid@ut-emx.uucp
- Organization: The University of Texas at Austin; Austin, Texas
- Lines: 19
-
-
- Can Standard C functions be overloaded?
-
- #include <string.h>
- int atoi(const String&); // legal?
- char* s = "123";
- String str = "456";
- int i1 = atoi(s);
- int i2 = atoi(str);
-
- One problem, I believe, is that ANSI C allows functions to be defined
- by the implementation as macros, so you might have to do:
-
- int (atoi)(const String& s); // now legal?
- String str = "456";
- int i = (atoi)(str); // annoying
-
- Jamshid Afshar
- jamshid@emx.utexas.edu
-