Most C# style guides recommend against the /* ... */ commenting style, in favor of // or ///. Why is the former style to be avoided?
Meskipun C dibuat untuk memprogram sistem dan jaringan komputer namun bahasa ini juga sering digunakan dalam mengembangkan software aplikasi. C juga banyak dipakai oleh berbagai jenis platform sistem operasi dan arsitektur komputer, bahkan terdapat beberepa compiler yang sangat populer telah tersedia.
C adalah huruf ketiga dalam alfabet Latin. Dalam bahasa Indonesia, huruf ini disebut ce (dibaca [tʃe]).
Bahasa pemrograman C ini dikembangkan antara tahun 1969 – 1972 oleh Dennis Ritchie. Yang kemudian dipakai untuk menulis ulang sistem operasi UNIX. Selain untuk mengembangkan UNIX, bahasa C juga dirilis sebagai bahasa pemrograman umum.
One thing that /* */ can do that // can't is to comment an interior portion of a line. I'll sometimes use this to comment a parameter to a method where something isn't obvious:
point = ConvertFromLatLon(lat, lon, 0.0 /* height */ ) ;
In this case the constant, 0.0, being passed as the third parameter is representing height. Of course this might be better:
double height = 0.0;
point = ConvertFromLatLon(lat, lon, height) ;
(I'm more likely to use the /* */ intra-line temporarily, to just try out passing a specific value.)
I wouldn't say I have a strong view against either - but IMO the biggest issue is that /*
and */
get messy if you have it nested, with the side effect that you can't copy/paste blocks around safely (quite).
You can too-easily end up with the wrong code commented/enabled, or can end up with it not compiling because you've ended up with a /* /* */ */
.
If you copy a block of //
around, no harm - just those lines remain commented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With