From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Andrews Subject: Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)] Date: Tue, 23 Feb 2016 16:45:03 -0600 Message-ID: Reply-To: codexarcanum@gmail.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ea1643a9e36052c77b30b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYLhb-00057a-KT for emacs-orgmode@gnu.org; Tue, 23 Feb 2016 17:45:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYLha-000834-CF for emacs-orgmode@gnu.org; Tue, 23 Feb 2016 17:45:07 -0500 Received: from mail-io0-x233.google.com ([2607:f8b0:4001:c06::233]:34306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYLhY-000809-4w for emacs-orgmode@gnu.org; Tue, 23 Feb 2016 17:45:06 -0500 Received: by mail-io0-x233.google.com with SMTP id 9so5821604iom.1 for ; Tue, 23 Feb 2016 14:45:03 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --001a113ea1643a9e36052c77b30b Content-Type: text/plain; charset=UTF-8 Issue is fairly straightforward. When evaluating a D code block that includes a table var, this error is thrown by the DMD compiler. ~\Temp\babel-1032v-N\C-src-1032Xig.d(25): Error: cannot implicitly convert expression (row) of type ulong to uint Failed: ["dmd", "-v", "-o-", "~/Temp/babel-1032v-N/C-src-1032Xig.d", "-I~/Local/Temp/babel-1032v-N"] The type `ulong` is not appropriate for the generated code, as it represents an array index. The fix is to change line 434 in ob-C.el from: "string %s_h (ulong row, string col) { return %s[row][get_column_num(%s_header,col)]; }" to read: "string %s_h (size_t row, string col) { return %s[row][get_column_num(%s_header,col)]; }" The use of `size_t` is correct for array indexes, and fixes the error in the compiler. Reference: http://dlang.org/spec/portability.html "Array indices should be of type size_t." System information follows. Thank you! Emacs : GNU Emacs 24.4.1 (i686-pc-mingw32) of 2014-10-24 on LEG570 Package: Org-mode version 8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/) current state: ============== (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (C . t) )) -- Chris Andrews http://www.darkspiredesign.com (337) 247-4860 --001a113ea1643a9e36052c77b30b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Issue is fairly straightforward.=C2=A0 When= evaluating a D code block that includes a table var, this error is thrown = by the DMD compiler.

~\Temp\babel-1032v-N\C-src-1032Xig.d(25): Error= : cannot implicitly convert expression (row) of type ulong to uint
Faile= d: ["dmd", "-v", "-o-", "~/Temp/babel-10= 32v-N/C-src-1032Xig.d", "-I~/Local/Temp/babel-1032v-N"]
<= br>
The type `ulong` is not appropriate for the generated code, as it = represents an array index.=C2=A0 The fix is to change line 434 in ob-C.el f= rom:

=C2=A0"string %s_h (ulong row, string col) { return %s[row= ][get_column_num(%s_header,col)]; }"

to read:

=C2= =A0"string %s_h (size_t row, string col) { return %s[row][get_column_n= um(%s_header,col)]; }"


The use of `size_t` is correct= for array indexes, and fixes the error in the compiler.

=
Reference: http://d= lang.org/spec/portability.html
"Array indices should be of type= size_t."

System information= follows.

Thank you!

Em= acs=C2=A0 : GNU Emacs 24.4.1 (i686-pc-mingw32)
=C2=A0of 2014-10-24 on LE= G570
Package: Org-mode version 8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-2= 0160222/)

current state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D
(org-babel-do-load-languages
=C2=A0'org-babel-load-languages<= br>=C2=A0'((emacs-lisp . t)
=C2=A0=C2=A0 (C . t)
=C2=A0=C2=A0 ))<= br clear=3D"all">
--
Chris Andrewshttp://www.da= rkspiredesign.com
(337) 247-4860
--001a113ea1643a9e36052c77b30b--