Re: Correct way to throw exceptions/errors from C to ST

Roland Plüss <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>

On 04/06/2015 06:45 PM, Holger Hans Peter Freyther wrote:
> On Sun, Apr 05, 2015 at 05:47:29PM +0200, Roland Plüss wrote:
>
>> What you mean with "C-style error"? A C++ exception (that doesn't work
>> it looks like)? The cCall is of void return type so I can't return
>> anything. And smalltalk side can't check the arguments as the
>> information required to perform the checks is sometimes located deep
>> inside the engine code base.
> "C-style" error.. a non zero return code and maybe setting a
> variable with the semantic of errno. The return type of "void"
> is your decision? Can't you return something to indicate success
> or failure?
I sure can decide the return type. I just considered it quite quick and
easy if I could return an #int if I link to a function actually
returning an integer. I certainly could return nil but then I have no
idea what error really happened nor can I properly catch it (well...
besides ifNotNil: ). Since Smalltalk has already an exception/error
system why not using it? I don't like wrangling a language unless
there's no other choice.

And as far as I know I can't include any code into a <primitive>
declared method.

I once did the trick with errno type error handling in a module I made
for Smalltalk but it's cumbersome to use and error prone.

-- 
Mit freundlichen Grüssen
Plüss Roland

Leader und Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
- Sowie verschiedene Blender Export-Skripts und Game-Tools

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUkBLMACgkQjKGu9ysRWfr75QCgoobdTwDqENMQwO7I/5nWUXsV
NK4AoKKWFfvDSO3+ISxAbU73sPB/R0ga
=GvF4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.