Code: Select all
/*
some section you want to disable here
*/
Code: Select all
///*
some section you want to disable here (this is now active)
//*/
Code: Select all
/*
some section you want to disable here
*/
Code: Select all
///*
some section you want to disable here (this is now active)
//*/
Code: Select all
/*
/* This won't compile */
*/
Code: Select all
/*
// old comment
old code
*/
I think the standard way is something likeab1jx wrote: ↑Wed Sep 05, 2018 2:42 amRight, I've gotten the "multiline comment" warning if I have a line continued with a \ at the end then use // at the beginning of both. Commenting only the first line doesn't work, I guess because the \ is ignored after the // is there.
I've usedbefore, I just never had a reason to do the opposite before. Very glad to find it worked.Code: Select all
/* // old comment old code */
Code: Select all
#if 0
code that is commented out
#endifCode: Select all
#include <stdio.h>
int main(void)
{
int fr\
ed = 0;
/** The above will be treated as is if you wrote
int fred = 0;
**/
// printf("Hello\n"); \
printf("World\n");
return 0;
}
+1 yes indeed.ejolson wrote: ↑Wed Sep 05, 2018 3:20 amI think the standard way is something likeThis works because preprocessor defines nest properly as opposed to comment delimiters.Code: Select all
#if 0 code that is commented out #endif
Code: Select all
6.4.9 Comments
1 Except within a character constant, a string literal, or a comment, the characters /*
introduce a comment. The contents of such a comment are examined only to identify
multibyte characters and to find the characters */ that terminate it. 83)
2 Except within a character constant, a string literal, or a comment, the characters //
introduce a comment that includes all multibyte characters up to, but not including, the
next new-line character. The contents of such a comment are examined only to identify
multibyte characters and to find the terminating new-line character.This is nice because (maybe) you can have // and /* */ comments inside. /* */ comments are a nuisance because you can't nest them, but they're faster than adding // to each line. It seems to be mostly a problem if you imported something written in a different program, or by somebody else.ejolson wrote: ↑Wed Sep 05, 2018 3:20 amI think the standard way is something likeThis works because preprocessor defines nest properly as opposed to comment delimiters.Code: Select all
#if 0 code that is commented out #endif
Yes exactly.
Code: Select all
#if 0
old code
#else
new code to try ...
#endifCode: Select all
#if (0)
extern void XSetWMName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
);
which calls:
extern void XSetTextProperty(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */,
Atom /* property */
);
And bear this in mind:
/*
* new structure for manipulating TEXT properties; used with WM_NAME,
* WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
*/
typedef struct {
unsigned char *value; /* same as Property routines */
Atom encoding; /* prop type */
int format; /* prop data format: 8, 16, or 32 */
unsigned long nitems; /* number of data items in value */
} XTextProperty;
#endif