Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It looks like the StopBits enumeration is in place for type-safety. It has the values None, One, Two, and OnePointFive. With just those four values, any representation other than an enumeration would be either inefficient or confusing.

http://msdn.microsoft.com/en-us/library/system.io.ports.stop...

http://en.wikipedia.org/wiki/Asynchronous_start-stop



Not really, no. The "stop bit" is an asynchronous delay inserted between the transition edge of the final bit of a byte and the rising edge of the next start bit. It's a fundamentally analog unit of time that just happens to be measured in "bits". In principle, there could be hardware that wants three stop bits, or 0.7. To the extent that there are only four values, that's purely because of historical convention (and maybe limitations of early PC UARTs, I don't have datasheets handy).

All of which could have been easily and more robustly encapsulated by the use of a float instead of the bizzaro-world enum that they chose.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: