This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Request to drop daft GNU extension


I'd like to request we drop a GNU extension. I realise this will make me unpopular with the backwards compatibility crowd, but there are sound reasons for doing so. The one I'd like to drop is the following kludged meaning of ## (taking the example from the info manual) #define eprintf(format, args...) fprintf (stderr, format , ## args) My reasons for doing so are as follows: 1) This use of ## has nothing to do with its true meaning of token pasting, certainly when our macro expanding is token-based. See point 4) for an example of why this is a problem. 2) It is entirely redundant. The justification put forth in the manual is resolving the "embarrassment" of an extra comma when invoked as eprintf ("success!\n", ) which gives fprintf (stderr, "success!\n", ) However, this is just masking the fact that your macro really has more arguments in the variable part than you're claiming it has, and thus I would suggest that it should be redefined as:- #define eprintf(format...) fprintf (stderr, format) and then the invocations eprintf ("%s:%d: ", input_file_name, line_number) eprintf ("success!\n") give the desired result in both cases. This redundancy is what convinces me there will never be anything like this in the standard. 3) It prevents correct usage of ##. Consider #define foo(a, b...) a ## b Invoking this macro with foo (1, ) drops the 1 to give an empty expansion, whereas it should expand as the single token <1>. 4) It makes the macro expansion code uglier than it already is. I have implemented it in the new macro expander, but I don't think we should implement it. Comments? Neil.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]