From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: babel C, C++, D enhancement Date: Fri, 13 Jun 2014 07:47:54 -0400 Message-ID: <8738f9dno9.fsf@gmail.com> References: <878urc0zmw.fsf@bzg.ath.cx> <874n1ryeq1.fsf@bzg.ath.cx> <87y4xgxu74.fsf@Rainer.invalid> <87r438uycj.fsf@bzg.ath.cx> <538BA215.2050305@free.fr> <877g4uezak.fsf@gmail.com> <5394C55B.7010906@free.fr> <87tx7vq955.fsf@gmail.com> <87ha3p8fq9.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvQAa-0001kW-LE for emacs-orgmode@gnu.org; Fri, 13 Jun 2014 08:01:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvQAW-0002Ef-EX for emacs-orgmode@gnu.org; Fri, 13 Jun 2014 08:01:20 -0400 Received: from mail-oa0-x22e.google.com ([2607:f8b0:4003:c02::22e]:61500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvQAW-0002EG-An for emacs-orgmode@gnu.org; Fri, 13 Jun 2014 08:01:16 -0400 Received: by mail-oa0-f46.google.com with SMTP id m1so2737421oag.5 for ; Fri, 13 Jun 2014 05:01:15 -0700 (PDT) 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: Achim Gratz Cc: emacs-orgmode@gnu.org Achim Gratz writes: > Eric Schulte writes: >> This new patch looks great, and the test suite passes locally. I've >> just applied it. > > You also get a warning from the byte-compiler on something that is > clearly a bug. I think the fix should be: > > --8<---------------cut here---------------start------------->8--- > diff --git a/lisp/ob-C.el b/lisp/ob-C.el > index dd03fa7..a794e2a 100644 > --- a/lisp/ob-C.el > +++ b/lisp/ob-C.el > @@ -264,7 +264,7 @@ (defun org-babel-C-val-to-C-type (val) > (list > (if (equal org-babel-c-variant 'd) "string" "const char*") > "\"%s\"")) > - (t (error "unknown type %S" type))))) > + (t (error "unknown type %S" basetype))))) > (cond > ((integerp val) type) ;; an integer declared in the #+begin_src line > ((floatp val) type) ;; a numeric declared in the #+begin_src line > --8<---------------cut here---------------end--------------->8--- > Agreed, I've just pushed up a fix. Please feel free to push these sorts of obvious bug fixes yourself in the future. > > The type determination is a tad optimistic, too. An Emacs integer may > or may not fit into C type "int" depending on how Emacs is compiled and > which compiler you are using. > Certainly, more refinement wouldn't hurt. Best, Eric > > > Regards, > Achim. -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw)