Article View: borland.public.cppbuilder.nativeapi
Article #3194Re: Passing structure to a fucntion by Reference vs by Value
From: Ed Mulroy
Date: Mon, 24 Jul 2006 21:35
Date: Mon, 24 Jul 2006 21:35
19 lines
1627 bytes
1627 bytes
The program slows down by the amount of time it takes make a copy of the structure on the stack. If recursion is used then each time you recurse it again uses one structure-sized hunk of stack and delays for however long the copy takes for each iteration. Using a reference is normally a better way, especially if recursion is involved. . Ed > Renald Yazmir wrote in message > news:44c5268d@newsgroups.borland.com... > > Are there any problems passing structure by value to a function? > Can it be a problem for multiple recursive calls? > My structure contains 10 doubles, 1 short and char arr[6]. > Any memory restrictions?
Technical Details
Message-ID:
<44c53d17$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<44c5268d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3cf5aff04a8c9a29 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Ed Mulroy" <dont_email_me@bitbuc.ket> Newsgroups: borland.public.cppbuilder.nativeapi References: <44c5268d@newsgroups.borland.com> Subject: Re: Passing structure to a fucntion by Reference vs by Value Date: Mon, 24 Jul 2006 17:35:18 -0400 Lines: 21 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 66.57.117.102 Message-ID: <44c53d17$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1153776919 66.57.117.102 (24 Jul 2006 14:35:19 -0700) X-Authenticated-User: edmulroy Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail