|
|
|
|
|
by touisteur
1026 days ago
|
|
You're returning a string which size might be known at compile time through inter procedural analysis. Too easy. The secondary stack would better be used for 'functions returning objects, of which you don't know the size, at call time'. function Any_Number (A : Natural) return String is
begin
if A = 42 return "A = Quarante Deux";
end if;
return "A =" & A'Image;
end Any_Number;
Or for those allergic to begin/end function Any_Number (A : Natural) return String is (if A = 42 then "A = Quarante Deux" else "A =" & A'Image);
|
|