* Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)]
@ 2016-02-23 22:45 Chris Andrews
2016-02-25 20:23 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Chris Andrews @ 2016-02-23 22:45 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1787 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)]
2016-02-23 22:45 Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)] Chris Andrews
@ 2016-02-25 20:23 ` Nicolas Goaziou
2016-03-20 14:31 ` Thierry Banel
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2016-02-25 20:23 UTC (permalink / raw
To: Chris Andrews; +Cc: emacs-orgmode
Hello,
Chris Andrews <codexarcanum@gmail.com> writes:
> 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.
Thank you for the report.
Do you want to provide a patch for that? See
<http://orgmode.org/worg/org-contribute.html> for details, if you're
interested.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)]
2016-02-25 20:23 ` Nicolas Goaziou
@ 2016-03-20 14:31 ` Thierry Banel
2016-03-25 23:30 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Thierry Banel @ 2016-03-20 14:31 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
Attached is a patch to keep Babel D compliant
with the latest version of the language.
Thanks Chris for reporting.
Thierry
Le 25/02/2016 21:23, Nicolas Goaziou a écrit :
> Hello,
>
> Chris Andrews <codexarcanum@gmail.com> writes:
>
>> 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.
> Thank you for the report.
>
> Do you want to provide a patch for that? See
> <http://orgmode.org/worg/org-contribute.html> for details, if you're
> interested.
>
> Regards,
>
[-- Attachment #2: 0001-use-size_t-in-babel-D.patch --]
[-- Type: text/x-diff, Size: 916 bytes --]
From 5f5dbf0a0d0c9cf364c02842f245d4651dac76b8 Mon Sep 17 00:00:00 2001
From: Thierry Banel <tbanelwebmin@free.fr>
Date: Sun, 20 Mar 2016 15:24:14 +0100
Subject: [PATCH] use size_t in babel D
* lisp/ob-C.el (org-babel-C-header-to-C): change ulong to size_t for
indexing a table as mandated by the latest version of the D language
(thanks to Chris Andrews)
---
lisp/ob-C.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index dd34b0b..8275313 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -431,7 +431,7 @@ specifying a variable with the name of the table."
table table (length headers) table))
(d
(format
- "string %s_h (ulong row, string col) { return %s[row][get_column_num(%s_header,col)]; }"
+ "string %s_h (size_t row, string col) { return %s[row][get_column_num(%s_header,col)]; }"
table table table))))))
(provide 'ob-C)
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)]
2016-03-20 14:31 ` Thierry Banel
@ 2016-03-25 23:30 ` Nicolas Goaziou
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2016-03-25 23:30 UTC (permalink / raw
To: Thierry Banel; +Cc: emacs-orgmode
Hello,
Thierry Banel <tbanelwebmin@free.fr> writes:
> Attached is a patch to keep Babel D compliant
> with the latest version of the language.
Applied. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-25 23:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-23 22:45 Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)] Chris Andrews
2016-02-25 20:23 ` Nicolas Goaziou
2016-03-20 14:31 ` Thierry Banel
2016-03-25 23:30 ` Nicolas Goaziou
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.