-1

While reading code I sometimes come across a backslash being used inside of a method body or inside of a define statement. I keep on looking, but I can't figure out what it does. I tried to include a snippet but it was too messy to understand. I am asking about the \'s from lines 113 - 137.

https://github.com/DarthTon/Blackbone/blob/master/src/BlackBone/Process/RPC/RemoteFunction.hpp

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631

3 Answers3

2

Those are backslashes, not forward-slashes. They are used to indicate that a #define is spanning multiple lines, rather than ending at the first newline.

See: Multi line preprocessor macros

David Scarlett
  • 3,171
  • 2
  • 12
  • 28
0

In your example link, note line 116 that starts with #define....

Lines 116-136 each have that trailing backslash you mention. These escape the newline sequences at the end of each line of source, effectively combining the next line (as far as the preprocessor is concerned) with the previous.

So the net effect is that lines 116 through 137 look like one long line to the preprocessor, necessary for that #define DECLPFN... to be defined on one (virtual) line and also to remain readable.

Phil Brubaker
  • 1,257
  • 3
  • 11
  • 14
0

A backslash \ at the end of a line indicates a continuation of the current line by the following line. In the particular case cited, it is being used to allow multi-line expression of a preprocessor macro. The preprocessor requires that a macro be completely defined in one line. This can make long macro definitions humanly unreadable; so, the line-breaks are suffixed by \ in order to enable the preprocessor to work properly while allowing the text to be readable by the programmer(s).

bill.lee
  • 2,207
  • 1
  • 20
  • 26