I have a unit named Head which exports a single procedure also named Head. In the calling program, the compiler (20050331) generates an error, "statement used as expression." The docs don't seem to say anything about a name limitation. Have my previous two Pascals let me get away with something naughty? Of course, renaming either the unit or the procedure fixes the problem.
Jerry
lanceboyle@qwest.net wrote:
I have a unit named Head which exports a single procedure also named Head. In the calling program, the compiler (20050331) generates an error, "statement used as expression." The docs don't seem to say anything about a name limitation. Have my previous two Pascals let me get away with something naughty? Of course, renaming either the unit or the procedure fixes the problem.
Yes, due to qualified identifiers (which GPC didn't support until somewhat more than a year ago), unit names (more precisely, interface names) conflict with declarations.
BTW, which previous Pascals (unless you mean earlier GPC versions) allow this? Borland Pascal doesn't, AFAIR.
Frank
Frank Heckenbach wrote:
lanceboyle@qwest.net wrote:
I have a unit named Head which exports a single procedure also named Head. In the calling program, the compiler (20050331) generates an error, "statement used as expression." The docs don't seem to say anything about a name limitation. Have my previous two Pascals let me get away with something naughty? Of course, renaming either the unit or the procedure fixes the problem.
Yes, due to qualified identifiers (which GPC didn't support until somewhat more than a year ago), unit names (more precisely, interface names) conflict with declarations.
BTW, which previous Pascals (unless you mean earlier GPC versions) allow this? Borland Pascal doesn't, AFAIR.
CodeWarrior Pascal does.
Regards,
Adriaan van Os
On Mar 1, 2006, at 1:01 AM, Adriaan van Os wrote:
Frank Heckenbach wrote:
lanceboyle@qwest.net wrote:
I have a unit named Head which exports a single procedure also named Head. In the calling program, the compiler (20050331) generates an error, "statement used as expression." The docs don't seem to say anything about a name limitation. Have my previous two Pascals let me get away with something naughty? Of course, renaming either the unit or the procedure fixes the problem.
Yes, due to qualified identifiers (which GPC didn't support until somewhat more than a year ago), unit names (more precisely, interface names) conflict with declarations.
BTW, which previous Pascals (unless you mean earlier GPC versions) allow this? Borland Pascal doesn't, AFAIR.
CodeWarrior Pascal does.
Regards,
Adriaan van Os
And THINK Pascal. Jerry
At 8:54 +0100 1/3/06, Frank Heckenbach wrote:
BTW, which previous Pascals (unless you mean earlier GPC versions) allow this? Borland Pascal doesn't, AFAIR.
Neither MW Pascal nor THINK Pascal before it had any problem with it.
It was definitely a pain when that change came in, but such is life. Peter.