Error handling in ValArray containers

J

jacob navia

I have some questions concerning ValArrays.

(1) What happens when you write

ValArray A,B,C;

C = A+B;

and A is of different length than B?

Is this an error or is it implementation defined?
Is there an exception defined for this error?

I have difficulties finding any related information.

(2) If you have a long double ValArray A, and a float array B
the expression
C = A+B
returns a long double result that is converted to the type of
C or is there any promotion/demotion rules?


Thanks in advance.

jacob
 
I

Ian Collins

I have some questions concerning ValArrays.

(1) What happens when you write

ValArray A,B,C;

C = A+B;

and A is of different length than B?

Is this an error or is it implementation defined?
Is there an exception defined for this error?

26.3.3.1/3

If the argument arrays do not have the same length, the behavior is
undefined.
I have difficulties finding any related information.

Have you checked the standard?
(2) If you have a long double ValArray A, and a float array B
the expression
C = A+B
returns a long double result that is converted to the type of
C or is there any promotion/demotion rules?

26.3.3.1/1

Each of these operators may only be instantiated for a type T to which
the indicated operator can be applied
and for which the indicated operator returns a value which is of type T
or which can be unambiguously converted to type T.
 
J

jacob navia

Le 12/04/11 12:55, Ian Collins a écrit :

[snip]

Thanks a lot Ian. I did not find that for stupidity reasons :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top