+ 1

(C++) How are functions working in headers?

For example, maybe you know there are functions thats called isupper() or islower() etc. in <cctype> header. I want to learn how are they working? In www.cplusplus.com web site, It shows how is it working like that: isupper(c); c is a character. If c is uppercase it returns true, false otherwise. However, I want to see the codes inside isupper() function. People are saying me on the internet, you dont need to see the codes but I think to learn more things I need to see them.

25th Nov 2017, 8:33 AM
Mustafa K.
Mustafa K. - avatar
5 Answers
+ 5
You could code them yourself. You'll learn more things than just seeing them. You cannot see the functions. What's the point? This is a concept known as abstraction (I think). You only need to know how to code whatever you want to code, you don't need to know the smaller details. Example: do you ever think of the small little bits in your computer when solving a programming problem? How logic gates do everything? No, because that's unnecessary. Simply put, you don't need to see the code. If you want to learn from these functions, code them yourself. You'll learn more things than seeing the code. 😉
25th Nov 2017, 8:40 AM
blackcat1111
blackcat1111 - avatar
+ 4
@Mustafa K. Well, they could convert it to the ASCII value. According to the chart, 65-90 is A-Z and 97-122 is a-z. Then, it's just a simple check of the ASCII value of the character in question. (At least, that's how I would do it. 😉)
25th Nov 2017, 8:54 AM
blackcat1111
blackcat1111 - avatar
+ 2
Standard library functions for C can be implemented in many ways, the implementations vary. If you are using Visual studio, here is an article on how you can view the source code for functions from the runtime dll in debug mode: https://msdn.microsoft.com/en-us/library/aa296413(v=vs.60).aspx
25th Nov 2017, 8:50 AM
aklex
aklex - avatar
+ 1
Is there any way to see these codes?
25th Nov 2017, 8:33 AM
Mustafa K.
Mustafa K. - avatar