emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Ernesto Durante <stobossey@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: babel: ob-C with Visual C++ and compilation-mode
Date: Sun, 17 Aug 2014 22:41:57 -0400	[thread overview]
Message-ID: <87r409cihz.fsf@gmail.com> (raw)
In-Reply-To: 87zjf8cdjk.fsf@gmail.com

Ernesto Durante <stobossey@gmail.com> writes:

> Thierry Banel <tbanelwebmin@free.fr> writes:
>
>>> I have identified a minor bug. When a source code block has the mode
>>> cpp, we cannot expand the code or more precisely the code is not
>>> expanded in the correct way because the following function is missing  
>>>
>>> (defun org-babel-expand-body:cpp (body params)
>>>   "Execute BODY according to PARAMS.This function calls `org-babel-expand-body:C++'."
>>>   (org-babel-expand-body:C++ body params))
>> Thanks for reporting this ! You may consider submitting a patch for this
>> bug. The comment "Execute BODY ..." should be changed to "Expand BODY ...".
>>
>>>
> Ok I will change the comment
>

I'd be happy to commit this patch after you make this change and
re-format with "git format-patch".  Also, please consider filling out
the FSF copyright assignment paperwork, so that we may accept larger
patches from you in the future.

Thanks for you contributions!
Eric

>
>>> Best
>>> Ernesto
>> You are very welcome
>> Thierry
>
> Thank you Thierry for your answer and all the details. I really want to be a contributor
> and help ob-C to improve (as well as can do a modest lisper).
>
> I tried to find a way to master Cx11 and babel is helping me a lot.
> I think babel can really accelerate learning and dissimation of C++.
>
> In this perspective, I have another very simple idea that I want to share
> with you. I find C++ too noisy. In the following piece of code
> I really find the presence of the main call and the return statement really annoying and useless.
>
> #+begin_src C++ :includes '(<iostream> <cassert>) :results silent
> template <typename T1, typename T2>
> auto compose(T1 t1, T2 t2) -> decltype(t1 + t2) { return t1+t2; }
>
> int main() {
>  auto d=compose(std::string("ola"),std::string("ciao")); //d's type is std::string
>  auto i=compose(4,2);
>  assert(d== std::string("olaciao") && i==6);
> return 0
> }
> #+end_src
>
>
> We can remove it by letting ob-C do the work by modifying the function
> org-babel-C-ensure-main-wrap. Now the code looks (according to me) easier to read
>
> #+begin_src C++ :includes '(<iostream> <cassert>) :results silent
> template <typename T1, typename T2>
> auto compose(T1 t1, T2 t2) -> decltype(t1 + t2) { return t1+t2; }
>
> template <>
> int compose(int t1,int t2) { return t1+t2; }
>
> ////main////
> auto d=compose(std::string("ola"),std::string("ciao")); //d's type is std::string
> auto i=compose(4,2);
> assert(d== std::string("olaciao") && i==6);
> #+end_src
>
> What do you think ?
>
> Best
> Ernesto
>
>
>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)

  parent reply	other threads:[~2014-08-22  3:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 16:16 babel: ob-C with Visual C++ and compilation-mode Ernesto Durante
2014-08-11 19:40 ` Thierry Banel
2014-08-12 14:24   ` Ernesto Durante
2014-08-12 22:03     ` Thierry Banel
2014-08-13 20:58       ` Ernesto Durante
2014-08-14 20:40         ` Thierry Banel
2014-08-15 17:22           ` Ernesto Durante
2014-08-17 11:20             ` Thierry Banel
2014-08-18 11:19               ` Ernesto Durante
2014-08-18 12:51                 ` Eric Schulte
2014-08-24 13:05                   ` Ernesto Durante
2014-08-28 14:02                     ` Eric Schulte
2014-08-18 19:59                 ` Thierry Banel
2014-08-20 20:40                   ` Ernesto Durante
2014-08-21 19:48                     ` Thierry Banel
2014-08-24 12:57                       ` Ernesto Durante
2014-08-28 19:44                         ` Thierry Banel
2014-08-18  2:41         ` Eric Schulte [this message]
2014-08-18  2:40 ` Eric Schulte
2014-08-23 11:03   ` Ernesto Durante
2014-08-25 16:35   ` [PATCH] " Ernesto Durante
2014-08-28 14:46     ` Eric Schulte
2014-09-10  9:27       ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r409cihz.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=stobossey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).