lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 28 Jul 2011 13:08:53 +0200
From:	Andreas Schwab <schwab@...hat.com>
To:	Guennadi Liakhovetski <g.liakhovetski@....de>
Cc:	Bernd Petrovitsch <bernd@...rovitsch.priv.at>,
	linux-kernel@...r.kernel.org
Subject: Re: [Q] compiler no longer warning about undeclared struct?

Guennadi Liakhovetski <g.liakhovetski@....de> writes:

> I always thought you need forward declarations for those, as in
>
> struct yy;
>
> before declaring struct xx above.

You only need that if you would otherwise introduce the struct tag in a
different scope, like prototype scope (which ends at the end of the
prototype).

>> Otherwise you could not define recursive structures as in
>> ----  snip  ----
>> struct a {
>> 	struct *b;
>> };
>> struct b {
>> 	struct *a;
>> };
>> ----  snip  ----
>
> I would add a "struct b;" forward declaration before "struct a".

You can do that, but since a struct definition doesn't introduce a new
scope it is not necessary.

Andreas.

-- 
Andreas Schwab, schwab@...hat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ