emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC/PATCH] naming src/bin files in ob-C.el


From: Leo Butler
Subject: Re: [RFC/PATCH] naming src/bin files in ob-C.el
Date: Sun, 14 May 2023 20:19:29 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

On Sat, May 13 2023, Ihor Radchenko <yantar92@posteo.net> wrote:

> Leo Butler <Leo.Butler@umanitoba.ca> writes:
>
>>> IMHO, it will be more consistent with other backends to use :results file 
>>> :file /path/to/executable
>>
>> No, I don't think this is the way to do it. What happens in this
>> case is:
>>
>> 1. `org-babel-C-execute' creates a named source file, compiles it to the
>>    named binary file;
>> 2. then executes that binary file, producing output;
>> 3. that output is inserted into the named binary file, overwriting its
>>    contents.
>
> What I am suggesting is making :results file :file /path/to stop after 1
> and produce a link to the binary file.

Ok, stopping after 1 seems reasonable when the code block is meant to
produce just the executable. But, your suggestion would mean that the
code block can *only* produce an executable file. Maybe that is ok, but
since the current semantics allow something like

#+begin_src C++ :includes <iostream> <fstream> :results file :file ./results.csv
  using namespace std;
  for(int i=0; i<10; i++){ cout << i << "," << i*i << endl; }
#+end_src

so I am not sure that we should break that.

On the other hand, I don't see any sense in producing a link to the
binary file. Org can't do anything with that link, so the user would
need to write something like ":results file :file /path/to :wrap
comment". That is why I would prefer something like a :bin-file header.

Leo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]