Deutsch English Français Italiano |
<20240531081143.419@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.c Subject: Re: C23 thoughts and opinions Date: Fri, 31 May 2024 15:34:29 -0000 (UTC) Organization: A noiseless patient Spider Lines: 53 Message-ID: <20240531081143.419@kylheku.com> References: <v2l828$18v7f$1@dont-email.me> <00297443-2fee-48d4-81a0-9ff6ae6481e4@gmail.com> <v2lji1$1bbcp$1@dont-email.me> <87msoh5uh6.fsf@nosuchdomain.example.com> <f08d2c9f-5c2e-495d-b0bd-3f71bd301432@gmail.com> <v2nbp4$1o9h6$1@dont-email.me> <v2ng4n$1p3o2$1@dont-email.me> <87y18047jk.fsf@nosuchdomain.example.com> <87msoe1xxo.fsf@nosuchdomain.example.com> <v2sh19$2rle2$2@dont-email.me> <87ikz11osy.fsf@nosuchdomain.example.com> <v2v59g$3cr0f$1@dont-email.me> <v30l15$3mcj6$1@dont-email.me> <v30lls$3mepf$1@dont-email.me> <v30sai$3rilf$1@dont-email.me> <v320am$1km5$1@dont-email.me> <v33ggr$e0ph$1@dont-email.me> <v34bne$i85p$1@dont-email.me> <v3758s$14hfp$1@raubtier-asyl.eternal-september.org> <v38of2$1gsj2$1@dont-email.me> <v39v87$1n7bk$1@dont-email.me> <20240530170836.00005fa0@yahoo.com> <v3a3k5$1ntrn$1@dont-email.me> <20240530180345.00003d9f@yahoo.com> <v3chc4$27uij$1@dont-email.me> Injection-Date: Fri, 31 May 2024 17:34:30 +0200 (CEST) Injection-Info: dont-email.me; posting-host="be4518a799bc3fa2f27a0cf115882681"; logging-data="2411673"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++TQf2Dznk6im/43+gI3YnO9Z7fPaJ714=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:JjIVy6Rx7vYquKDROhKuU1Bw/ZE= Bytes: 3237 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