[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Gm2] Returning a string constant
From: |
Breeden, Thomas (tmb) |
Subject: |
RE: [Gm2] Returning a string constant |
Date: |
Mon, 27 Oct 2008 17:22:35 -0400 |
Gaius, et. al.,
Neat. I had thought you had implemented structured type returns.
I plan to avoid them like the plague :)
Though, if they discourage anyone from writing string functions that
return POINTER TO CHAR or something like that resembling that
"C" practice, they have done a good thing.
BTW, one thing that has puzzled me about the ISO Standard is that it
states "No direct assignments to open array formal parameters may be
made" - no ifs, ands, or buts.
So the, when s is an open array parameter, the
s := "test";
alternative to
Assign("test",s);
should be illegal in an ISO conforming compile mode
but I am not sure why.
So far as I can see, either way, if HIGH() is accurate it should be safe,
and if not, unsafe.
Tom
address@hidden
> -----Original Message-----
> From: Gaius Mulley [mailto:address@hidden
> Sent: October 27, 2008 4:52 PM
> To: Breeden, Thomas (tmb)
> Cc: address@hidden
> Subject: Re: [Gm2] Returning a string constant
>
> "Breeden, Thomas (tmb)" <address@hidden> writes:
>
> > Hi all,
> >
> > Actually, in ISO Standard Modula-2, it is legal.
> > ...
> Hi,
>
> now fixed in the CVS. GNU Modula-2 allows formal parameters to be
> specified as:
>
> FormalParameters := '(' [ MultiFPSection ] ')' [ ':' Qualident ]
> =:
>
> which is (after the ":") the same as PIM2 p148 line 80,
> PIM3 p172 line 76, PIM4 p158 line 80 and ISO p641 C.2.4.2.
>
> Many thanks for the bug report - it did work if a temporary
> variable was used, such as:
>
> PROCEDURE test () : string ;
> VAR
> t: string ;
> BEGIN
> t := "test" ;
> RETURN t
> END test ;
>
> but it should have worked without the need for this temporary..
>
> regards,
> Gaius
- [Gm2] Returning a string constant, Scott Robinson, 2008/10/26
- Re: [Gm2] Returning a string constant, Andreas Fischlin, 2008/10/26
- Re: [Gm2] Returning a string constant, Iztok Kobal, 2008/10/27
- RE: [Gm2] Returning a string constant, Breeden, Thomas (tmb), 2008/10/27
- Re: [Gm2] Returning a string constant, Gaius Mulley, 2008/10/27
- RE: [Gm2] Returning a string constant,
Breeden, Thomas (tmb) <=
- Re: [Gm2] Returning a string constant, Gaius Mulley, 2008/10/27
- Re: [Gm2] Returning a string constant, Andreas Fischlin, 2008/10/28
- Re: [Gm2] Returning a string constant, Iztok Kobal, 2008/10/30
- Re: [Gm2] Returning a string constant, Christian Maurer, 2008/10/28