From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "guile@discard.email" Newsgroups: gmane.lisp.guile.bugs Subject: bug#18592: FFI should have portable access to =?UTF-8?Q?=E2=80=98errno=E2=80=99?= Date: Sun, 25 Jan 2015 21:59:32 +0100 Message-ID: <486f6ad7a668e9afc56fd0f101a171d8@discard.email> References: <87fvf8oocf.fsf@ft.bewatermyfriend.org> Reply-To: guile@discard.email NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="b1_486f6ad7a668e9afc56fd0f101a171d8" X-Trace: ger.gmane.org 1422234438 2521 80.91.229.3 (26 Jan 2015 01:07:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2015 01:07:18 +0000 (UTC) To: 18592@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jan 26 02:07:13 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFY92-0007xi-MG for guile-bugs@m.gmane.org; Mon, 26 Jan 2015 02:07:12 +0100 Original-Received: from localhost ([::1]:39489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFY91-0008Ok-Q2 for guile-bugs@m.gmane.org; Sun, 25 Jan 2015 20:07:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFY8w-0008L0-0K for bug-guile@gnu.org; Sun, 25 Jan 2015 20:07:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFY8s-0003Fm-Qh for bug-guile@gnu.org; Sun, 25 Jan 2015 20:07:05 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFY8s-0003Fc-NV for bug-guile@gnu.org; Sun, 25 Jan 2015 20:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YFY8s-0006hp-4N for bug-guile@gnu.org; Sun, 25 Jan 2015 20:07:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87fvf8oocf.fsf@ft.bewatermyfriend.org> Resent-From: "guile@discard.email" Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 26 Jan 2015 01:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18592 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 18592-submit@debbugs.gnu.org id=B18592.142223440125747 (code B ref 18592); Mon, 26 Jan 2015 01:07:02 +0000 Original-Received: (at 18592) by debbugs.gnu.org; 26 Jan 2015 01:06:41 +0000 Original-Received: from localhost ([127.0.0.1]:56376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFY8W-0006h7-Da for submit@debbugs.gnu.org; Sun, 25 Jan 2015 20:06:41 -0500 Original-Received: from app.discard.email ([37.120.161.148]:37283) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFUHN-0000BT-W5 for 18592@debbugs.gnu.org; Sun, 25 Jan 2015 15:59:34 -0500 Original-Received: by app.discard.email (Postfix, from userid 33) id AEF6DE1A3D; Sun, 25 Jan 2015 21:59:32 +0100 (CET) X-PHP-Originating-Script: 0:PHPMailer.class.php X-Priority: 3 X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/) X-Mailman-Approved-At: Sun, 25 Jan 2015 20:06:38 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7719 Archived-At: --b1_486f6ad7a668e9afc56fd0f101a171d8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'd like to point out that when calling a function that might set errno in = C, it's usually good practice to set errno to zero immediately before the call= , so as to be sure that any subsequent non-zero errno value was actually a consequence of the function call: =C2=A0 errno =3D 0; /* clear errno before the function call */ rtnval =3D my_func(...); if (errno !=3D 0) {...} =C2=A0 This should probably be taken into account if you're extending the FFI to provide access to errno. --b1_486f6ad7a668e9afc56fd0f101a171d8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

I'd like to point out that when calling a function that might set errno = in C,

it's usually good practice to set errno to zero immediately before the c= all,

so as to be sure that any subsequent non-zero errno value was actually

a consequence of the function call:

 

errno =3D 0; /* clear errno before the function call */

rtnval =3D my_func(...);

if (errno !=3D 0) {...}

 

This should probably be taken into account if you're extending

the FFI to provide access to errno.

--b1_486f6ad7a668e9afc56fd0f101a171d8--