Re: Easy question about Character manipulation



On 30/1/07 01:43, in article 1170121405.6329.89.camel@localhost, "Georg
Bauhaus" <bauhaus@xxxxxxxx> wrote:

On the contrary, this *exactly* like (ISO Standard) Pascal.

I don't think so, if a Pascal compiler is supposed
to determine "the same type" (exact same type) by looking
at the definition, not the name. Otherwise two compilers
claiming to support ISO Pascal are broken:

Trust me, I was one of the team that wrote the standard. 8-)

program p;

type
T = 1 .. 3;
S = 1 .. 3;
var
x : T;
y : S;
begin
x := y; { fine in Pascal }
end.

This program seems to be Standard Pascal, and compiles.

This does not imply that S and T are considered to be the same type.
(See below.)

The corresponding Ada program will not compile:

procedure p is
type T is range 1 .. 3;
type S is range 1 .. 3;
x : T;
y : S
begin
x := y; -- not the same type, compilation error
end;

This is not a matter of type equivalence,
it is a matter of automatic type conversion on assignment
(assignment compatibility), and that IS unlike Ada, of course.

It would work just as well in Pascal if S were 1..3 and T were 2..4,
and these are obviously not the same type.

(There are further classes of compatibility in other Pascal contexts.)

--
Bill Findlay
<surname><forename> chez blueyonder.co.uk


.



Relevant Pages

  • Re: any regex gurus out there?
    ... > No matter what number or combination of backslashes I used it didn't work. ... - The compiler wouldn't take it otherwise. ... or escape each backslash with a backslash, ... > French language, the letter A may have three different accents. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Comparison to Comparison
    ... alive", no matter how long you wait after the Collect call, and no ... regardless of the size of the array. ... As near as I can tell, the issue is that when you assign into the objectas part of the argument to the WeakReference constructor, the compiler generates a hidden local variable. ... But, absent a more invasive inspection of the execution of the code, I'd admit that even your code example isn't proof of that. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C Programmer Needed
    ... >> For that matter, there isn't much from C99 that I miss. ... only thing either does is assert a guarantee that the program does not ... compiler vendors that matter a long time ago. ...
    (comp.programming)
  • Re: object system...
    ... ceases to matter, or at least until more code needs to be built around it.. ... for a compiler the program is a text. ... optimizations the ... No index range check here is necessary, because the compiler knows that I ...
    (comp.object)
  • Re: Strange value
    ... Note that the compiler always initializes data members in the ... For instance, _matter before _identifier. ... Welcome to "Undefined Behavior". ...
    (comp.lang.cpp)