| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| The interface to foreign function libraries e.g. written in C does not allow any checks for consistency and is therefore unsafe. Isn't it better if the compiler requests the UNSAFE flag for modules that use the <*EXTERNAL*> pragma? |
|
#2
| |||
| |||
| Henning Thielemann <iakd0@cluster.urz.uni-halle.de> wrote in message news:<Pine.A42.3.96.1030708124556.49942B-100000@clustera.urz.uni-halle.de>... > The interface to foreign function libraries e.g. written in C does not > allow any checks for consistency and is therefore unsafe. Isn't it better > if the compiler requests the UNSAFE flag for modules that use the > <*EXTERNAL*> pragma? I see your point, but I think the lack of safety resides in the module you're calling, not in the call. Just as if you had written an unsafe module with a safe interface: the result of the call might be unsafe, if the programmer who wrote the module got it wrong, but the call itself is not an unsafe operation. - Darko |
|
#3
| |||
| |||
| On 9 Jul 2003, Darko wrote: > Henning Thielemann <iakd0@cluster.urz.uni-halle.de> wrote in message news:<Pine.A42.3.96.1030708124556.49942B-100000@clustera.urz.uni-halle.de>... > > The interface to foreign function libraries e.g. written in C does not > > allow any checks for consistency and is therefore unsafe. Isn't it better > > if the compiler requests the UNSAFE flag for modules that use the > > <*EXTERNAL*> pragma? > I see your point, but I think the lack of safety resides in the module > you're calling, not in the call. Just as if you had written an unsafe > module with a safe interface: the result of the call might be unsafe, > if the programmer who wrote the module got it wrong, but the call > itself is not an unsafe operation. I would agree with Darko I think - for instance if Math.i3 was unsafe, chaos would result. The fact that you're calling it with and it returns a sensible type (ie not ADDRESS or something) means that it should be down to the module to be safe once the interface is declared as safe. I do wonder whether there should be some sort of reverse process though. For example, EXTERNAL is assumed to be UNSAFE unless you do something like SAFE EXTERNAL. This would then allow a variety of different types of external functions to be used. Currently I generally split things into two and have a safe and an unsafe interface depending on the function. Ed. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.