kaoh / globalplatform

C library + command-line for Open- / GlobalPlatform smart cards
https://kaoh.github.io/globalplatform/
Other
72 stars 30 forks source link

Improve "const correctness" #22

Closed kaoh closed 4 years ago

kaoh commented 19 years ago

Would you like to apply the advices from the article "http://en.wikipedia.org/wiki/Const_correctness" to your sources? I suggest to add the key word "const" to more function signatures. Some implementation comments ("... IN ...") seem to indicate this detail. But it is not repeated in the parameters.

http://cvs.sourceforge.net/viewcvs.py/globalplatform/OpenPlatform/OpenPlatform.c?rev=1.3&view=markup

Reported by: elfring

kaoh commented 18 years ago

Logged In: YES user_id=1309428

Maybe in a next version. The const qualifier would appear nearly in most function parameters. Although it could be more correct, it is only a contract between the programmer which is using the API and the API, no enforcement of correctness. A lot of programmers would be offended by using const variables or castings for the functions. I will see.

Original comment by: kaoh

kaoh commented 17 years ago

Logged In: YES user_id=572001 Originator: YES

I know that the suggested refactoring will affect more places. I hope that cases will be uncovered that are potential error sources.

Original comment by: elfring