I have the following source:
int main() { 000J; }
With gcc 4.8.4 it compiles without errors. I know there are suffixes like L or U, but I didn't find anything about J.
So what does it do?
I have the following source:
int main() { 000J; }
With gcc 4.8.4 it compiles without errors. I know there are suffixes like L or U, but I didn't find anything about J.
So what does it do?
As zenith mentioned, this is a GNU extension for writing imaginary literals. I really want to comment on the rationale of using
j
for this purpose as imallett is wondering but I don't have enough reputation to comment on zenith's answer. I'll leave this as an answer anyway as it might be helpful to others.As this link explains, both
i
andj
can be used to write imaginary literals using this GNU extension. The reason whyi
is used for this is obvious, but the reason whyj
is used as well is thatj
is commonly used to denote the imaginary unit in electrical engineering and control systems engineering to prevent confusion asi
is already used to denote electrical current in those contexts.I get a warning:
The
J
suffix is a GNU extension, which causes the literal to be of a_Complex
type.More info here: https://gcc.gnu.org/onlinedocs/gcc/Complex.html