Re: Efficient Parameter passing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dave Rahardja (ask_at_me.com)
Date: 10/06/04


Date: Wed, 06 Oct 2004 03:00:17 GMT

Macca wrote:
> Hi,
>
> This is a general question to do with efficiency of passing parameters
> betwen functions.
>
> I have a function that requires a number of vectors.
>
> These vectors may be quite large in size so I thought about creating a
> structure that holds the vectors and then passing a pointer to this structure
> to the fuction that needs them.
>
> How would this compare to passing references to each vector, probably 5-6
> vectors needed, as parameters to the function?
>
> I'd appreciate any opinions on these methods of parameter passing and other
> methods.
>
> Thanks In Advance

In C++, passing a reference costs exactly the same as passing a pointer.



Relevant Pages

  • Re: [PATCH] [0/9] Use 64bit x86 machine check code for 32bit too
    ... warning: passing argument 2 of ‘strict_strtoull’ makes integer from pointer without a cast ...
    (Linux-Kernel)
  • Re: ByVal vs. ByRef
    ... But I still don't understand why I have to pass the TreeNode argument ByVal. ... I understand why passing it ByVal works. ... What is "the Value" of a reference variable? ... A "pointer" to the object. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Can a ref parameter be saved for later use?
    ... but in this scenario the 'passing back' will have to happen later. ... Form(ref string[] strLst) { ... Even in C/C++ it's a dangerous thing to capture a pointer to some data and save it for reuse later. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [opensuse] Promise SATA300-4TX kernel Module Fails to Build?
    ... passing argument 2 of ‘writeb’ makes pointer from integer without a cast ... missing whitespace after the macro name ...
    (SuSE)
  • Re: Critical section shared betwen dll and main program
    ... I am discussing the case of dynamic DLL ... loading and passing PCRITICAL_SECTION between old version of DLL ... and an executable which was build in newer environment. ... without passing a pointer to the kernel32.dll? ...
    (microsoft.public.win32.programmer.kernel)