Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Auto-execute code at exit? Date: Mon, 18 Dec 2017 09:13:00 -0800 Organization: None to speak of Lines: 34 Message-ID: References: <016d6ddd-a7f6-498f-9fa0-244a5879bb9f@googlegroups.com> <_QaYB.132221$sg1.100336@fx43.am4> <87po7hre73.fsf@gmail.com> <%gEYB.365$uW7.71@fx07.am4> <87k1xn51q9.fsf@bsb.me.uk> <878te34lzi.fsf@bsb.me.uk> <87bmiwyrls.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="163ed92b6be4f08dc3d4d295197acf21"; logging-data="10406"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UAfAsL5oMWKDx18QoyZCQ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:ugABqT2qgKwgu8f4FqrYwQNDL+g= sha1:SuSWUpI+lW2SUL+/WdpD2CMXHqc= Xref: csiph.com comp.lang.c:124461 Ben Bacarisse writes: > bartc writes: [...] >> If I look at MSVC's windows headers, then in windef.h line 283, there is: >> >> typedef int (FAR WINAPI *FARPROC)(); > > This is not an example of kind of the code in question. Function > pointers are often declared in some generic way either because they can > not be type-checked (due to some non-portable system trick being used) > or they are later cast at the point of call. I'm reasonably sure that form of function pointer declaration is also obsolescent. N1570 6.11.6 says: The use of function declarators with empty parentheses (not prototype-format parameter type declarators) is an obsolescent feature. A non-obsolescent version might be: typedef int (FAR WINAPI *FARPROC)(void); (assuming that FAR and WINAPI expand to something reasonable). This would allow calls with casts, but would trigger a mandatory diagnostic for a call with arguments via such a pointer (which is the whole point of prototypes). -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"