Deutsch   English   Français   Italiano  
<vjlmia$dese$1@dont-email.me>

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: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: transpiling to low level C
Date: Sat, 14 Dec 2024 20:39:39 -0800
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <vjlmia$dese$1@dont-email.me>
References: <vjlh19$8j4k$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 15 Dec 2024 05:39:39 +0100 (CET)
Injection-Info: dont-email.me; posting-host="1b9ecb52f1e3580c8ecb0ff3bc0436cb";
	logging-data="441230"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/9iwXbFNyNHLdXtDJQwSatebZ1sKZCYHA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:gcKY1NfTR5Cgw2u8klWEMUyu0OY=
In-Reply-To: <vjlh19$8j4k$1@dont-email.me>
Content-Language: en-US
Bytes: 1699

On 12/14/2024 7:05 PM, Thiago Adams wrote:
> 
> I am working on a C backend that generates simple C code.
> 
> You can test it here:
> http://thradams.com/cake/playground.html

[...]

Wrt to C11, it is missing <stdatomic.h>:
________________________
#include <stdio.h>
#include <stdatomic.h>

struct ct_bar
{
     int a;
     int b;
     atomic_int m_atomic;
};

struct ct_foo
{
     char* a;
     struct ct_bar bar;
};

int main()
{
     struct ct_foo foo = { "Hello", { 1, 2, 0 } };

     atomic_exchange(&foo.bar.m_atomic, 42);

     printf("%s\n%d\n%d\n%d\n",
         foo.a, foo.bar.a, foo.bar.b, foo.bar.m_atomic);

     return 0;
}
________________________