lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Am 24.11.18 um 00:28 schröbte Sean Conner:
It was thus said that the Great Viacheslav Usov once stated:

The very first message of mine in this thread explained how having multiple
definitions of external linkage identifiers in an "entire program" is
undefined behaviour, quoting the standard.

   That was 6.9#5, which I quoted a portion of, but here's the full quote:

	5 An external definition is an external declaration that is also a
	  definition of a function (other than an inline definition) or an
	  object. If an identifier declared with external linkage is used in
	  an expression (other than as part of the operand of a sizeof
	  operator whose result is an integer constant), somewhere in the
	  entire program there shall be exactly one external definition for
	  the identifier; otherwise, there shall be no more than one.

   I'm not reading "undefined behavior" there, I see "error" there.  Annex J
of the C99 standard lists all the unspecified, undefined,
implementation-defined and locale-specific behaviors.  Nowhere is this

This one is easy. Very first bullet point in Annex J.2.1:
	J.2 Undefined behavior
	1 The behavior is undefined in the following circumstances:
	— A ‘‘shall’’ or ‘‘shall not’’ requirement that appears outside
	of a constraint is violated (clause 4).

Which refers to 4.2 in the normative part of the standard:

	2 If a ‘‘shall’’ or ‘‘shall not’’ requirement that appears
	outside of a constraint is violated, the behavior is undefined.
	Undefined behavior is otherwise indicated in this International
	Standard by the words ‘‘undefined behavior’’ or by the omission
	of any explicit definition of behavior. There is no difference
	in emphasis among these three; they all describe ‘‘behavior that
	is undefined’’.

   -spc (So did I use two non-comformant compilers for this experiment then?)