Re: why cant functions return arrays



jacob navia <jacob@xxxxxxxxxx> writes:

Ben Bacarisse wrote:
Maybe I missed the document you mean.

http://www.q-software-solutions.de/~jacob/
There you will find a link to the specifications.

Ah, yes. That says a little more but not really enough. For example
I don't see anything about not allowing

T &operator=(T&, T&);

lcc-win32 seems to reject

T &operator=(T&, T*);

but that is not explained. Is that a problem with the compiler or the
specification?

How many times is operator= called in these cases:

T &operator=(T& x, int i) { ... }

T a1[5] = {1,2};
T a2 = {3};
(T[2]){1,2};

struct S { T t; };
S s1 = {1};
S s2 = {.x = 2};
S as[5] = {1,2};

Is the following permitted:

const T x = 42;
x = 43;

The compiler allows it but the specifications says nothing about it.

What is the meaning of a pointer argument? What does the remark
"References can be replaced by arrays of length 1." mean?

After reading the specification, I have more questions than when I started.

It would be very good for everybody if you would develop them
with me.

We disagree to much. I've already said I think it is a mistake to
consider initialisation as the same as assignment, for example. I
think we just see thing far too differently.

--
Ben.
.



Relevant Pages

  • Re: Mult-thread macro
    ... how many can you really cover with a single name (nevermind details like library specifications, optimization levels, and other options) for the C++ compiler? ... by the compiler or that of libraries supplied with it. ... even is generally conditionalized on some "thread mode" compilation symbol to use the prehistoric "extern int errno;" or some per-thread errno macro magic. ...
    (comp.programming.threads)
  • Are there sites to remotely test very small pieces of C++ on cross platforms in case MS C++/ specs a
    ... problem is either in the compiler and / or the C++ standard specifications. ... pointers of 3 instanciated templates where some of the pointers members ...
    (microsoft.public.vc.language)
  • Re: C question
    ... > the fact that the operator is used twice in the above expression, ... according to the specifications of the C language. ... the compiler can chose whatever it likes to do - including ... invoke what is called undefined behaviour - the result is simply not ...
    (comp.programming)
  • Re: Only Sham SW Engineering Without System Approach and Scientific Method
    ... One reason I like to use Ada for important projects is that both the ... Specs and the Implementation are representable in code. ... must conform to the specification because the compiler ensures that ... one can compile the specifications long before there is any ...
    (comp.object)
  • Re: If you cant test it, you must plan it [Was: OOP/OOD Philosophy]
    ... >> Converting requirements to specifications must be done, ... Automating the specifications ... If you are building a compiler there are ... > driving force in a project. ...
    (comp.object)