Skip to main content
deleted 341 characters in body
Source Link

I think i found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But iI think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things iI think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years - but maybe you will not have that lucky... so consider your problem with care and it should do good.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

I think i found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But i think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things i think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years - but maybe you will not have that lucky... so consider your problem with care and it should do good.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

I think i found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But I think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things I think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

added 8 characters in body
Source Link

I think i found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But i think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things i think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years - but maybe you will not have that lucky... so consider your problem with care and it should do good.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

I found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But i think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things i think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years - but maybe you will not have that lucky... so consider your problem with care and it should do good.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

I think i found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But i think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things i think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years - but maybe you will not have that lucky... so consider your problem with care and it should do good.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

added 97 characters in body
Source Link

I found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But i think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things i think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years - but maybe you will not have that lucky... so consider your problem with care and it should do good.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

I found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But i think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things i think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

I found a easy solution!

cpp -P yourcommentedfile.txt 

SOME UPDATES:

Quote from the user ilkachu (original text from the user comments):

I played a bit with the options for gcc: -fpreprocessed will disable most directives and macro expansions (except #define and #undef apparently). Adding -dD will leave defines in too; and std=c89 can be used to ignore new style // comments. Even with them, cpp replaces comments with spaces (instead of removing them), and collapses spaces and empty lines.

But i think it is still reasonable and a easy solution for the most of the cases, if you disable the macro expansion and other things i think you will get good results... - and yes you can combine that with shell script for getting better... and much more...

I am personally using cpp -P (without any other parameter) for removing comments from php files without any problem for years - but maybe you will not have that lucky... so consider your problem with care and it should do good.

If that is not enough for you, try stripcmt - a comment remover: http://www.bdc.cx/software/stripcmt/

deleted 18 characters in body
Source Link
Loading
added 119 characters in body
Source Link
Loading
added 107 characters in body
Source Link
Loading
deleted 8 characters in body
Source Link
Loading
added 56 characters in body
Source Link
Loading
added 56 characters in body
Source Link
Loading
deleted 2 characters in body
Source Link
Loading
deleted 6 characters in body
Source Link
Loading
deleted 6 characters in body
Source Link
Loading
Source Link
Loading