Comment Block of Selected Code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Comment Block of Selected Code

3,784 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rtos on Fri Jul 09 18:54:02 MST 2010
In LPCExpresso, is there a way to comment a block of selected code?
0 Kudos
Reply
6 Replies

3,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by domen on Sun Jul 11 23:54:14 MST 2010
Also... you could use the preprocessor:
#if 0
  commented code
#endif
0 Kudos
Reply

3,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KaraMuraT on Sat Jul 10 07:39:00 MST 2010
A little note:

If you want to write MISRA-C compatible code, you must not use "//" style line comments. You have to use "/* */" style.

This really causes a slowdown in development process at the time making some code practices, but saves you from forgetting some necessary codes line commented, for the release version.
0 Kudos
Reply

3,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rtos on Sat Jul 10 07:27:00 MST 2010

Quote: KaraMuraT
Hi,

Select the source code you want to comment,
Right click,
Select "Source\Comment/Uncomment"

I think this is what you want.

P.S: The shortcut key is "Ctrl+/"



This is exactly what I'm looking for.  Thanks!
0 Kudos
Reply

3,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KaraMuraT on Sat Jul 10 06:28:14 MST 2010
Hi,

Select the source code you want to comment,
Right click,
Select "Source\Comment/Uncomment"

I think this is what you want.

P.S: The shortcut key is "Ctrl+/"
0 Kudos
Reply

3,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rtos on Sat Jul 10 05:54:14 MST 2010
sojiro, thanks.  I'm aware of this method.  However this method does not work if you have one line comments (//) embedded in the block you want to comment.  Many other IDEs have a command that will automatically put the // comment indicator in front of all the lines that you have selected (and remove it).  That is what I'm looking for.
0 Kudos
Reply

3,500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sojiro on Sat Jul 10 05:44:52 MST 2010
//for commenting one line

/*
for commenting
blocks
*/
0 Kudos
Reply