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 <codexarca...@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,
>

>From 5f5dbf0a0d0c9cf364c02842f245d4651dac76b8 Mon Sep 17 00:00:00 2001
From: Thierry Banel <tbanelweb...@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

Reply via email to