Re: C23 thoughts and opinions

Liste des GroupesRevenir à cl c 
Sujet : Re: C23 thoughts and opinions
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.c
Date : 31. May 2024, 16:34:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240531081143.419@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-05-31, bart <bc@freeuk.com> wrote:
Here's how builtin embedding worked using a feature of my older C compiler:
>
   #include <stdio.h>
   #include <string.h>
>
   char hello[] = strinclude("hello.c");
>
   int main(void) {
       printf("hello =\n%s\n", hello);
       printf("strlen(hello) = %zu\n", strlen(hello));
       printf("sizeof(hello) = %zu\n", sizeof(hello));
   }

Lisp:

$ cat strincl.tl
(defmacro strinclude (path)
  (put-line `including @path`)
  (file-get-string path))

(defun test()
  (strinclude "/etc/hostname"))

When we run it interpreted we see from the debug put-line that /etc/hostname is
included at macro-expansion time before we run the test function:

$ txr -i strincl.tl
including /etc/hostname
This TTY may be recorded for privacy-violating and evidence-gathering purposes.
1> (test)
"sun-go\n"

Now compile the file: the file is pulled it at compile time. Twice. :)
A double expansion took place due to certain complexities of compiling.

$ txr --compile=strincl.tl
including /etc/hostname
including /etc/hostname

Now when we load the compiled file, the diagnostic trace
"including /etc/hostname" no longer appears: the string is part of the test
function as a literal:

$ txr -i strincl
TXR is enteric coated to release over 24 hours of lasting relief.
1> (test)
"sun-go\n"

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
31 May 24 * Re: C23 thoughts and opinions73bart
31 May 24 +* Re: C23 thoughts and opinions67Michael S
31 May 24 i+* Re: C23 thoughts and opinions65Michael S
31 May 24 ii`* Re: C23 thoughts and opinions64Michael S
31 May 24 ii `* Re: C23 thoughts and opinions63bart
31 May 24 ii  `* Re: C23 thoughts and opinions62Michael S
31 May 24 ii   `* Re: C23 thoughts and opinions61bart
31 May 24 ii    +* Re: C23 thoughts and opinions39jak
31 May 24 ii    i+- Re: C23 thoughts and opinions1bart
6 Jun 24 ii    i`* Re: C23 thoughts and opinions37BGB-Alt
7 Jun 24 ii    i +* Re: C23 thoughts and opinions32Lawrence D'Oliveiro
7 Jun 24 ii    i i+* Re: C23 thoughts and opinions15BGB-Alt
8 Jun 24 ii    i ii`* Re: C23 thoughts and opinions14Lawrence D'Oliveiro
8 Jun 24 ii    i ii +* Re: C23 thoughts and opinions11BGB
8 Jun 24 ii    i ii i+- Re: C23 thoughts and opinions1Lawrence D'Oliveiro
13 Jun 24 ii    i ii i`* Re: C23 thoughts and opinions9Bonita Montero
13 Jun 24 ii    i ii i `* Re: C23 thoughts and opinions8BGB
14 Jun 24 ii    i ii i  `* Re: C23 thoughts and opinions7Bonita Montero
14 Jun 24 ii    i ii i   `* Re: C23 thoughts and opinions6BGB
14 Jun 24 ii    i ii i    +* Re: C23 thoughts and opinions2Bonita Montero
14 Jun 24 ii    i ii i    i`- Re: C23 thoughts and opinions1BGB
15 Jun 24 ii    i ii i    `* Re: C23 thoughts and opinions3Lawrence D'Oliveiro
16 Jun 24 ii    i ii i     `* Re: C23 thoughts and opinions2BGB
16 Jun 24 ii    i ii i      `- Re: C23 thoughts and opinions1Lawrence D'Oliveiro
9 Jun 24 ii    i ii +- Re: C23 thoughts and opinions1Lawrence D'Oliveiro
9 Jun 24 ii    i ii `- Re: C23 thoughts and opinions1Michael S
8 Jun 24 ii    i i`* Re: C23 thoughts and opinions16Malcolm McLean
8 Jun 24 ii    i i +* Re: C23 thoughts and opinions14BGB
9 Jun 24 ii    i i i`* Re: C23 thoughts and opinions13Michael S
9 Jun 24 ii    i i i +* Re: C23 thoughts and opinions11bart
9 Jun 24 ii    i i i i`* Re: C23 thoughts and opinions10Michael S
9 Jun 24 ii    i i i i +- Re: C23 thoughts and opinions1Michael S
9 Jun 24 ii    i i i i +* Re: C23 thoughts and opinions7bart
9 Jun 24 ii    i i i i i`* Re: C23 thoughts and opinions6Michael S
9 Jun 24 ii    i i i i i `* Re: C23 thoughts and opinions5bart
9 Jun 24 ii    i i i i i  `* Re: C23 thoughts and opinions4Michael S
9 Jun 24 ii    i i i i i   `* Re: C23 thoughts and opinions3bart
9 Jun 24 ii    i i i i i    `* Re: C23 thoughts and opinions2Michael S
10 Jun 24 ii    i i i i i     `- Re: C23 thoughts and opinions1bart
11 Jun 24 ii    i i i i `- Re: C23 thoughts and opinions1Lawrence D'Oliveiro
10 Jun 24 ii    i i i `- Re: C23 thoughts and opinions1BGB
9 Jun 24 ii    i i `- Re: C23 thoughts and opinions1Lawrence D'Oliveiro
7 Jun 24 ii    i `* Re: C23 thoughts and opinions4BGB
7 Jun 24 ii    i  `* Re: C23 thoughts and opinions3Lawrence D'Oliveiro
7 Jun 24 ii    i   `* Re: C23 thoughts and opinions2BGB
7 Jun 24 ii    i    `- Re: C23 thoughts and opinions1BGB
31 May 24 ii    +* Re: C23 thoughts and opinions19bart
1 Jun 24 ii    i+* Re: C23 thoughts and opinions4jak
1 Jun 24 ii    ii`* Re: C23 thoughts and opinions3bart
1 Jun 24 ii    ii `* Re: C23 thoughts and opinions2jak
2 Jun 24 ii    ii  `- Re: C23 thoughts and opinions1Tim Rentsch
1 Jun 24 ii    i+* Re: C23 thoughts and opinions10bart
1 Jun 24 ii    ii+* Re: C23 thoughts and opinions5Tim Rentsch
1 Jun 24 ii    iii+- Re: C23 thoughts and opinions1Michael S
2 Jun 24 ii    iii`* Re: C23 thoughts and opinions3Tim Rentsch
6 Jun 24 ii    iii `* objcopy -I binary etc... Was: C23 thoughts and opinions2Michael S
6 Jun 24 ii    iii  `- Re: objcopy -I binary etc... Was: C23 thoughts and opinions1Tim Rentsch
1 Jun 24 ii    ii+- Re: C23 thoughts and opinions1David Brown
1 Jun 24 ii    ii+* Re: C23 thoughts and opinions2bart
4 Jun 24 ii    iii`- Re: C23 thoughts and opinions1Lawrence D'Oliveiro
4 Jun 24 ii    ii`- Re: Correct objcopy Usage (was Re: C23 thoughts and opinions)1Lawrence D'Oliveiro
1 Jun 24 ii    i`* Re: C23 thoughts and opinions4Michael S
2 Jun 24 ii    i +* Re: C23 thoughts and opinions2bart
2 Jun 24 ii    i i`- Re: C23 thoughts and opinions1Michael S
6 Jun 24 ii    i `- Re: C23 thoughts and opinions1Michael S
1 Jun 24 ii    `* Re: C23 thoughts and opinions2Michael S
2 Jun 24 ii     `- Re: C23 thoughts and opinions1Tim Rentsch
31 May 24 i`- Re: C23 thoughts and opinions1bart
31 May 24 +- Re: C23 thoughts and opinions1Kaz Kylheku
31 May 24 +- Re: C23 thoughts and opinions1Malcolm McLean
1 Jun 24 `* Re: C23 thoughts and opinions3Malcolm McLean
1 Jun 24  `* Re: C23 thoughts and opinions2bart
1 Jun 24   `- Re: C23 thoughts and opinions1Malcolm McLean

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal