A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1943.htm below:

__LINE__ and __FILE__ in macro replacement list


Submitter:Fred J. Tydeman
Submission Date:2015-06-23
Document: WG14 N1943
Related: WG14 N1911

Summary

Based upon my reading of the standard, it appears that the following are ambiguous, so are a possible defect.

An example of that.


  #line 500
  #define MAC() __LINE__

  #line 1000
 int j = MAC();         /* is this 500 or 1000? */

However, 7.2.1.1 requires that the assert macro write information about the call that has a false expression. That information includes the __LINE__ and __FILE__ preprocessing macros. So, there is a requirement that this specific macro using __LINE__ and __FILE__ have the line number and file name of the invocation, not the line number and file name of the replacment list (in <assert.h>).

Suggested Technical Corrigendum

Add to 6.10.8.1, paragraph 1, item __LINE__:

The line number associated with a __LINE__ in a macro replacment list is the line number of the macro invocation.

Add to 6.10.8.1, paragraph 1, item __FILE__:

The source file name associated with a __FILE__ in a macro replacment list is the source file name of the macro invocation.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4