Creating Ada record with one field
Posted
by ada hater
on Stack Overflow
See other posts from Stack Overflow
or by ada hater
Published on 2010-04-30T08:02:59Z
Indexed on
2010/04/30
8:07 UTC
Read the original article
Hit count: 221
ada
I've define a type:
type Foo is record
bar : Positive;
end record;
I want to create a function that returns an instance of the record:
function get_foo return Foo is
return (1);
end get_foo;
But Ada won't let me, saying "positional aggregate cannot have one argument".
Stupidly trying, I've added another dumb field to the record, and then return (1, DOESNT_MATTER);
works!
How do I tell Ada that's not a positional aggregate, but an attempt to create a record?
© Stack Overflow or respective owner