Re: Nested Multiline Comment

new topic     » goto parent     » topic index » view thread      » older message » newer message
eumini said...

Dear Developers,

The new multi-line commenting feature has proven to be quite useful. I have a question as to how it was designed to behave when nested.

The /* ... */ is intended not to be nested. The comment starts with /* and ends at the very next */ that it comes across.

The comment idea is intended to to help coders add comments to their code, and not explicitly intended to comment out valid code.

One way that you can do to comment out a large block of code is to use the ifdef facility.

For example:

ifdef COMMENT_OUT then 
enum  
--gretl_opt_flags 
    OPT_NONE = 0, 
    OPT_A = 1 <<  0, 
    OPT_B = 1 <<  1, 
    OPT_C = 1 <<  2, 
    OPT_D = 1 <<  3, 
    OPT_E = 1 <<  4, 
    OPT_F = 1 <<  5, 
    OPT_G = 1 <<  6, 
    OPT_H = 1 <<  7, 
    OPT_I = 1 <<  8, 
    OPT_J = 1 <<  9, 
    OPT_K = 1 << 10, 
    OPT_L = 1 << 11, 
    OPT_M = 1 << 12, 
    OPT_N = 1 << 13, 
    OPT_O = 1 << 14, 
    OPT_P = 1 << 15, 
    OPT_Q = 1 << 16, 
    OPT_R = 1 << 17, 
    OPT_S = 1 << 18, 
    OPT_T = 1 << 19, 
    OPT_U = 1 << 20, 
    OPT_V = 1 << 21, 
    OPT_W = 1 << 22, 
    OPT_X = 1 << 23, 
    OPT_Z = 1 << 24, 
    OPT_Y = 1 << 25, /* added 2009-03-15 */ 
    OPT_UNSET = 1 << 30 
end ifdef 
 

[/quote] By the way, probably coming in 4.1 we will have shift operators << and >> and enums that do binary increments, something like

enum by *2 
    OPT_NONE = 0, 
    OPT_A = 1,  -- #00000001 
    OPT_B, -- #00000002 
    OPT_C, -- #00000004 
    OPT_D, -- #00000008 
    OPT_E, -- #00000010 
  . . . etc ... 
    OPT_UNSET = 1 << 30 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu