This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Structure return


Paulo Flabiano Smorigo <pfsmorigo@gmail.com> writes:

> Is it possible to return a structure as the function return?

Yes.  This is a standard part of C/C++.


> I made a program to test if it's possible and worked, but now I have a
> few doubts:
> - It's secure to use this procedure?

Yes.

> - It's a true structure return or something else?

It's a true structure return.  I'm not sure what else it could be.

> - The ansi c standard allow this or it's a "plus" of gcc?

The standard allows it.


(There were compilers in the distant past for which returning a struct
was not thread-safe, because they used a static variable to return the
struct.  However, those compilers are long dead.  Returning a struct
is perfectly safe these days.)

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]