TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Darin McBride
from: Jasen Betts
date: 2003-09-04 07:07:16
subject: Pointers

Hi Darin.

02-Sep-03 21:31:54, Darin McBride wrote to Bo Simonsen


 DM> Hello Bo!

 DM> Replying to a message of Bo Simonsen to Darin McBride:

 BS>> Hello Darin!

 BS>> 01 Sep 03 14:01, you wrote to me:

 BS>>>> Can't i avoid to have a extra pointer?

 DM>>> Yes.  But not in C.  Okay, that's not entirely true - you'd have
 DM>>> to make significant changes, which are not always an option.  If
 DM>>> you wrote both the caller and callee, then these changes are
 DM>>> what I'd suggest anyway, even in C++.

 BS>> Hmm.. I looks like it would be easier with the extra pointer.

 DM> Personal preference, I suppose.  However, the method I proposed
 DM> below, despite being "more difficult", is, I believe, usually the
 DM> better choice

 DM> 1.  It is fast.  With no malloc/free (slow, expensive function
 DM> calls), it performs as fast as the caller allows.  The only thing
 DM> that would be faster is if we didn't need to copy at all, e.g.:
 DM> char const* test() { return "test"; } .

or
#define test() ("test")

:)


 -=> Bye <=-

---
* Origin: Bushido does not mean what it sounds like. (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

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™.