Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #395521
| From | Philipp Klaus Krause <pkk@spth.de> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: What is the meaning of array parameters? |
| Date | 2025-11-27 10:34 +0100 |
| Message-ID | <10g95vd$mdq5$1@solani.org> (permalink) |
| References | <10g4au7$jc8o$1@solani.org> |
Looking at clang and gcc diagnostics:
// Tested via gcc/clang -Wall -pedantic -Warray-parameter -Warray-bounds
test.c
void f(char a[4])
{
a[4] = 7; // clang doesn't warn. gcc warns with -O2/-O3 only
}
void g(void)
{
char a[3];
f(a); // gcc warns, clang doesn't.
f(0); // neither gcc nor clang warn
}
So apparently passing a null pointer is considered less bad by gcc than
passing an array shorter than declared. And clang doesn't care about
anything here.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What is the meaning of array parameters? Philipp Klaus Krause <pkk@spth.de> - 2025-11-25 14:28 +0100
Re: What is the meaning of array parameters? Michael S <already5chosen@yahoo.com> - 2025-11-25 16:04 +0200
Re: What is the meaning of array parameters? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-11-25 13:25 -0800
Re: What is the meaning of array parameters? Philipp Klaus Krause <pkk@spth.de> - 2025-11-27 10:34 +0100
Re: What is the meaning of array parameters? antispam@fricas.org (Waldek Hebisch) - 2025-11-29 22:28 +0000
Re: What is the meaning of array parameters? James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-11-29 22:01 -0500
Re: What is the meaning of array parameters? Andrey Tarasevich <noone@noone.net> - 2025-12-05 06:01 -0800
Re: What is the meaning of array parameters? Lynn McGuire <lynnmcguire5@gmail.com> - 2025-12-05 15:36 -0600
csiph-web