🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309887

Re: W której wersji standardu C lub C++ pracujecie?

#309887
From: PawelS pawel(at)wbcd(dot)pl
Date: Sun, 11 Aug 2019 18:11
34 lines
1880 bytes
Maciek Godek pisze:
> W dniu wtorek, 6 sierpnia 2019 14:02:33 UTC+2 użytkownik Queequeg napisał:
> To ważne, bo ani -Wall ani nawet -Wextra w GCC nie wyłapie czegoś takiego:
> 
> uint32_t f() {
>   return JAKAŚ_DUŻA_WARTOŚĆ;
> }
> 
> uint16_t x = f();
> 
> (co uważam że jest skandaliczne i byłem w szoku jak to odkryłem. Zresztą nadal jestem w szoku)

A to ciekawe, bo bez żadnych opcji gcc zgłasza ostrzeżenie:

gcc -v
------
gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)

test.c
------
#include <stdint.h>
uint32_t f() {
         return 0xffffffffffff;
}
int main() {
         uint16_t x = f();
         return 0;
}

gcc -o test test.c
------------------
test.c: In function 'f':
test.c:3: warning: integer constant is too large for 'long' type
test.c:3: warning: large integer implicitly truncated to unsigned type
Technical Details
Message-ID: <5d505a6e$0$17364$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
References: <a1fbe21b-aed9-4b32-9691-a824c4e31a21@trust.no1> <3f1215b5-3c16-4248-a74f-1b57d21d4c98@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Date: Sun, 11 Aug 2019 20:11:57 +0200
From: "PawelS pawel(at)wbcd(dot)pl" <fake@email.org>
User-Agent: Thunderbird 2.0.0.18 (X11/20081120)
MIME-Version: 1.0
Newsgroups: pl.comp.lang.c
Subject: Re: W której wersji standardu C lub C++ pracujecie?
References: <a1fbe21b-aed9-4b32-9691-a824c4e31a21@trust.no1> <3f1215b5-3c16-4248-a74f-1b57d21d4c98@googlegroups.com>
In-Reply-To: <3f1215b5-3c16-4248-a74f-1b57d21d4c98@googlegroups.com>
Lines: 34
Message-ID: <5d505a6e$0$17364$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 89.231.96.70
X-Trace: 1565547118 unt-rea-a-01.news.neostrada.pl 17364 89.231.96.70:35709
X-Complaints-To: abuse@news.neostrada.pl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit