Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vjhu52$3i4tq$1@dont-email.me>
Deutsch   English   Français   Italiano  
<vjhu52$3i4tq$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.misty.com!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Thiago Adams <thiago.adams@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: C89 "bug"
Date: Fri, 13 Dec 2024 15:24:34 -0300
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <vjhu52$3i4tq$1@dont-email.me>
References: <vjh8hu$3den0$1@dont-email.me>
 <87jzc3v48r.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Dec 2024 19:24:35 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8b9a0b17735b443b8fd85bb0477dd1c9";
	logging-data="3740602"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+45VEnLQejrlTpQqdNWlCHro+dIQWdx9I="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:WpcPOcJTgjKPNNRmg1Mb8KAjED8=
Content-Language: en-GB
In-Reply-To: <87jzc3v48r.fsf@nosuchdomain.example.com>
Bytes: 1887

Em 12/13/2024 3:15 PM, Keith Thompson escreveu:
> Thiago Adams <thiago.adams@gmail.com> writes:
>> Does anyone knows how can I convert this code (external declaration) to C89?
>>
>> union U {
>>      int i;
>>      double d;
>> };
>>
>> union U  u = {.d=1.2};
>>
>> The problem is that in C89 only the first member of the union is
>> initialized.
> 
> The obvious solution is:
>      union U u;
>      u.d = 1.2;
> But that works only if u has automatic storage duration.
> 
> You could also define a function that takes a double argument and
> returns a union U result.

Like this?
union U {
     int i;
     double d;
};
union U f(){ union U u; u.d = 1.2; return u;}
union U u = f();

The problem is that f() is not a constant expression for external 
declarations.