Deutsch   English   Français   Italiano  
<vi56hi$3ie0o$2@dont-email.me>

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

Path: ...!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!news.gegeweb.eu!gegeweb.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: question about linker
Date: Tue, 26 Nov 2024 16:11:45 -0300
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <vi56hi$3ie0o$2@dont-email.me>
References: <vi54e9$3ie0o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 26 Nov 2024 20:11:46 +0100 (CET)
Injection-Info: dont-email.me; posting-host="582870763c644d3bdda32f5308bc8ee6";
	logging-data="3749912"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19zsNj7a5wb3O25f3BUEweswb/WIMSH2gg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QaUk5Z8nlTqG1ruQ2lXggTRssYU=
In-Reply-To: <vi54e9$3ie0o$1@dont-email.me>
Content-Language: en-US
Bytes: 2266

On 26/11/2024 15:35, Thiago Adams wrote:
> 
> (I think I know the answer but I would like to learn more.)
> 
> I am using C89 as "compiler backend intermediate language".
> 
> I want a very simple output that could facilitate the construction of a 
> simple C89 compiler focused on code generation.

Another question is.. does the compiler cares about function type when 
calling a function or this is just an information to avoid programmers 
mistakes?

Consider this code:

int main() {
     strcmp("a", "b");
}

It compiles in -std=c89

Now changing to -std=c99 -std=c11 it gives:

error: implicit declaration of function 'strcmp'


Then adding:

int strcmp();

int main() {
     strcmp("a", "b");
}

it works in C99 / C11

I think in C23 empty parameter list means no args, while in the previous 
versions (void) means no args.

Considering that in previous versions of C we could call a function 
without its signature I think the compiler only needs the caller side. 
(of course I am not considering programmer mistakes)

So, I think one extra simplification for small compilers is to ignore 
function parameters.