Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Programming standards and code reviews should sort this out. Inconsistent comments probably aren't that big a deal in the grand scheme of things but if they can't do that constantly what else are they up to.
-
Wait what?
Which language would support ALL of the following comment syntax? O__0
// ...
/* ... */
# ...
Code looks like PHP or something. Which I had no idea also supported #-comments -
@theImposter it is true. But you can find this kind of problems absolutely everywhere, not only in comments. Everyday is a new adventure, discovering new ways and mostly badly written things.
At least, it works... -
hrombach1788y@corscheid in PHP, // and # denote one-line comments
/*
...
*/ is supposed to be used for block comments and (in theory) using it for line comments wastes CPU time because it takes slightly longer to parse. -
@hrombach true, I knew about block comments with /**/, I was saying I had no idea that
# this can be 1-line comment in PHP
// This is how I thought it must be -
hrombach1788y@corscheid C++ has the same three types and I think many other languages inherited them too.
-
I always associated comment syntax like this:
// AND /**/
for languages like C, C++, Java, PHP..
#
For languages like Perl, Python, Bash..
Despite the fact that # is technically acceptable for comments in PHP, I still don't feel right using it. // Works just as well and seems more stylistically preferred/'correct' -
hrombach1788y@corscheid I agree actually, I don't use # comments in PHP code either. And whenever I get a PR that has # comments I usually change them to // before I merge. 😆
-
Kimmax111068y@hrombach Pretty sure PHP is the wrong language if you have to care about how fast the comments are being parsed
-
hrombach1788y@Kimmax firstly: not so true anymore since PHP 7
Secondly: that's why I added "in theory" -
@lucasgrelaud It is consistent with the code for example, in spanish:
if ( persona.Nombre.esValido ) {
guardar(persona);
}
It is inconsistent, besides a non-spanish speaker wouldn't understand it.
Related Rants
When my coworker doesn't want to believe his code is inconsistent, yet he changes the syntax for commenting 3 times over 10 lines.
undefined
comments
inconsistency
frenglish