Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread J. Gareth Moreton
Thanks so much for the insight Jonas.  Heh, Linus is as passionate as I am sometimes... volatile is evil and all!  It makes sense though... and it will encourage people to write better code. The 'spinning on a global variable' I admit I've used.  In my case it was in a slave thread that did

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread Jonas Maebe
On 05/05/2019 19:34, J. Gareth Moreton wrote: For the volatile intrinsic, was there talk of "volatile" being an attribute as well? I'm guessing this means declaring something as, for example "var FTerminated: Boolean volatile;" See

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread J. Gareth Moreton
I'd say the people have spoken.  No "safe"!  Don't worry, I'm not going to get angry or anything... I'm appreciating the discussion we're having. For the volatile intrinsic, was there talk of "volatile" being an attribute as well? I'm guessing this means declaring something as, for example

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread Jonas Maebe
On 05/05/2019 15:31, Marģers . via fpc-devel wrote: As mentioned in a previous message, fpc trunk supports a volatile intrinsic: http://wiki.freepascal.org/FPC_New_Features_Trunk#Support_for_.22volatile.22_intrinsic My bad, I didn't know about volatile intrinsic. So, does it mean that

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread Marģers . via fpc-devel
> As mentioned in a previous message, fpc trunk supports a volatile > intrinsic: > http://wiki.freepascal.org/FPC_New_Features_Trunk#Support_for_.22volatile.22_intrinsic My bad, I didn't know about volatile intrinsic. So, does it mean that compiler is allowed to optimize any variable, even

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread Jonas Maebe
On 05/05/2019 14:51, Marģers . via fpc-devel wrote: As i understand this idea is another way around key word "volatile" in order to allow compiler perform more optimization. Then why to go half way introducing "safe", when it's better introduce "volatile". Not too long ago here was discussion

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread Marģers . via fpc-devel
As i understand this idea is another way around key word "volatile" in order to allow compiler perform more optimization. Then why to go half way introducing "safe", when it's better introduce "volatile". Not too long ago here was discussion about it, but it was strongly rejected by core team. I

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread Jonas Maebe
On 04/05/2019 18:06, J. Gareth Moreton wrote: I've noticed that my take on coding is somewhat different to others at times.  I tend not to trust the compiler to make the most efficient code. You generally shouldn't, and it indeed generally won't do it either. That's why even with the most

Re: [fpc-devel] Possible idea... "safe" subroutines/methods

2019-05-05 Thread Sven Barth via fpc-devel
J. Gareth Moreton schrieb am So., 5. Mai 2019, 05:11: > One problem I do have with FPC and its optimiser is that -O4 is > specifically said that it may cause side-effects and even tongue-in-cheek > says "beware". To me, this is bad design because it discourages the end > users from using the