1

I know that we can use comments to refer to e.g. methods in java (see this).

Is this option available in c too? Lots of time while commenting, for example, I have a bug that is handled after 10 lines. How can I say to the other developer: "Do not handle it. It's handled on the next 'if()' block"?

int main(){ int x = 10; printf("x = %d\n", x); //don't check if x is more than 18. We will check it in another "if" //bla bla bla //... if(x >= 18) printf("OK we can submit you\n"); else { printf("No. You're too young\n"); return 1; } } 
10
  • 1
    FYI, in java that works only when generating the documentation, it doesn't link to the method in the source code. Commented Feb 17, 2022 at 8:31
  • @FedericoklezCulloca Thanks, but this kind of commentings is still usable when we ctrl+click on the comment in some IDEs. Better than nothing. Commented Feb 17, 2022 at 8:37
  • Note that these links cannot link to some random line number. You can reference "a module, package, class, or member name", but not to "the code 10 lines down". Commented Feb 17, 2022 at 9:13
  • So are you asking if and how a certain IDE can jump to certain locations from a comment in source code? Commented Feb 17, 2022 at 12:38
  • 1
    In JavaDoc the smallest referenceable unit is a "member" of a class: a constructor, a method or a field. You cannot address any smaller unit (i.e. neither line of code nor a block of code within a constructor or method) Commented Feb 20, 2022 at 17:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.