out-parameters from a c++ function

Choice 1: ptr param. You have the flexibility to pass in NULL, but you have the extra burden to check nulls, or risk seg fault.

Google style guide prefers this.

Choice 2: use a non-const reference param.

 

Advertisements

Fwd: c++ portability, according to csdoctor

With java, i think we get binary portability in the vast majority of cases. With c++ you usually get good source code portability unless obvious non-portable libraries are used.

———- Forwarded message ———-
From: Qiang Wang
Subject: Re: c++ portability

I think the answer is YES. You have portability problem if you want to move from Windows to UNIX, especially when applications have GUI, hardware driver, network functions. However, for a simple C++
application, you can run on both Windows and UNIX with minimal change after compiling on both systems separately.

Qiang

On Tue, Aug 24, 2010 at 9:01 AM, Bin TAN (Victor) wrote:
> Hi Friends,
>
> One potential IV question to verify hands-on c++ experience — Java has a
> big selling point “write once run anywhere”. If you wrote c++ in windows and
> run in unix, did you have portability problems?
>
> Is there any?