http://qs1969.pair.com?node_id=11129289


in reply to Is there a better way to use the line number in a quoted string than __LINE__?

Many great answers so far, but another option... printf()!

printf("%d looks very nice\n", __LINE__);

Easy to read, not a whole lot of crazy syntax, and very easy to update later if new variables are needed in the output (ie. don't have to trudge through making sure you're not breaking the concatenations).

Replies are listed 'Best First'.
Re^2: Is there a better way to use the line number in a quoted string than __LINE__?
by LanX (Sage) on Mar 07, 2021 at 20:55 UTC