"nil" not accepted as value for a pointer (OK in v4.60!)

Beta Testing discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

"nil" not accepted as value for a pointer (OK in v4.60!)

#1 Post by Dany » 29 Mar 2009 11:14

ref: mP PRO 1.34 beta (Vxx-4.00 bèta).

Normally, when a Pascal pointer should point to "nothing", the value "nil" should be assigned to it. in mP the word "nil" is shown as a reserved word, but not accepted as valid value for a pointer with a rather strange errormessage:

Code: Select all

var  Ptr: ^byte;
...
  Ptr := nil; // error
...
The error is: ":= is not a valid identifier".

2010-05-14: Still not Ok in mP v3.80.
Last edited by Dany on 28 Dec 2010 21:02, edited 7 times in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: "nil" not accepted as value for a pointer

#2 Post by zristic » 30 Mar 2009 15:16

How would you translate that code in ASM for PIC?

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: "nil" not accepted as value for a pointer

#3 Post by janni » 30 Mar 2009 16:54

zristic wrote:How would you translate that code in ASM for PIC?
Isn't it written in help:
You can also compare pointers to zero value – testing in that way if the pointer actually points to anything.
That fits nil definition as pointer's value that doesn't reference anything. Ptr:=nil should in effect mean Ptr:=0.

BTW, if the help says
Assigning the integer constant 0 to a pointer assigns a null pointer value to it.
shouldn't it be possible to perform such assignment without compiler warning 'Implicit typecast of integral value to pointer'? Or maybe it's better to reserve the keyword 'nil' for such operations?

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#4 Post by Dany » 30 Mar 2009 17:28

Thanks Janni. :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: [?]Vxx-3.80: "nil" not accepted as value for a po

#5 Post by Dany » 14 May 2010 20:52

2010-05-14: Still not Ok in mP v3.80.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Bryn
Posts: 26
Joined: 18 Apr 2009 12:38

Re: "nil" not accepted as value for a pointer

#6 Post by Bryn » 15 May 2010 22:11

'nil' is an integral part of standard pascal and it really should be implemented properly.
To err is human; to moo, bovine.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: "nil" not accepted as value for a pointer

#7 Post by Dany » 25 Sep 2010 10:19

Issue still there in v4.10.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: "nil" not accepted as value for a pointer

#8 Post by ranko.rankovic » 27 Sep 2010 10:31

Hello Dany,

I'm sorry for this, our developers will intensely fix this little issue.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: "nil" not accepted as value for a pointer

#9 Post by Dany » 27 Sep 2010 19:42

ranko.rankovic wrote:Hello Dany,
I'm sorry for this, our developers will intensely fix this little issue.
Best regards
No worries, it is only a minor issue. I do check all my own remarks every time a new compiler version comes out, and report the status of my remarks...
Keep up the good work! :D :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: "nil" not accepted as value for a pointer

#10 Post by Dany » 28 Dec 2010 21:02

mP v4.60: "nil" is defined now and accepted as legitimate value for a pointer.

Thanks mE guys! :D :D :D

Keep up the good work!
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: "nil" not accepted as value for a pointer (OK in v4.60!)

#11 Post by janni » 28 Dec 2010 22:16

Good news, indeed :), though the warning, 'Implicit typecast of integral value to pointer', issued when nil is assigned, is really unnecessary.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: "nil" not accepted as value for a pointer (OK in v4.60!)

#12 Post by Dany » 29 Dec 2010 09:31

janni wrote:... though the warning, 'Implicit typecast of integral value to pointer', issued when nil is assigned, is really unnecessary.
Indeed... :o
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal PRO for PIC Beta Testing”