Source Code for toUpper Function

J

JanWhitney

I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.
 
N

Noah Roberts

I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.

You can download the standard C library with GCC.
 
D

Default User

I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.

There is no "the source". Each implementation is free to write it the
way they want, as long as the behavior is what the standard requires.
For instance, one that uses ASCII might take a peek its current value
and subject a set value if its currently in the "lowercase" range.

Try doing a search for toupper.c to find some implementations.




Brian
 
S

Salt_Peter

I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.

Never heard of toUpper.

Take a look at ctype.h for a C answer and note that toupper(...)
becomes std::toupper(...) according to <cctype>.
 
D

Default User

Salt_Peter said:
Never heard of toUpper.

Take a look at ctype.h for a C answer and note that toupper(...)
becomes std::toupper(...) according to <cctype>.

How likely is that to give the OP the source code for the function?




Brian
 
S

Salt_Peter

Default said:
How likely is that to give the OP the source code for the function?

It should, it does here. And since C++ nor C are proprietary, hidden
implementations, if its not found there on his platform, it most
certainly will be found elsewhere.
 
D

Default User

Salt_Peter said:
It should, it does here.

It does? Where is "here"? I've not seen source code for library
functions in headers in any implementation I've ever used.
And since C++ nor C are proprietary, hidden
implementations, if its not found there on his platform, it most
certainly will be found elsewhere.

Say what? The implementations more certainly are proprietary, and are
often not distributed. Where did you get the idea that it was otherwise?




Brian
 
S

Salt_Peter

Default said:
It does? Where is "here"? I've not seen source code for library
functions in headers in any implementation I've ever used.


Say what? The implementations more certainly are proprietary, and are
often not distributed. Where did you get the idea that it was otherwise?

I said proprietary + hidden as in MFC/ATL etc where the source is
tucked away in object files. The source for toupper as well as the rest
of the C++ language might certainly be copyrighted, but hidden it is
most definitely not. Unless you happen to come accross some
implementation i've not seen.
 
D

Default User

Salt_Peter said:
I said proprietary + hidden as in MFC/ATL etc where the source is
tucked away in object files. The source for toupper as well as the
rest of the C++ language might certainly be copyrighted, but hidden
it is most definitely not. Unless you happen to come accross some
implementation i've not seen.


Well, I use Visual C++, and I don't believe they provide the
implementation. Libraries are the usual method. Some do provide the
source files, which allows the implementation to be built, but it's
certainly not required (and not typically found in headers anyway).





Brian
 
N

Noah Roberts

Default said:
Well, I use Visual C++, and I don't believe they provide the
implementation. Libraries are the usual method. Some do provide the
source files, which allows the implementation to be built, but it's
certainly not required (and not typically found in headers anyway).

But you can always get it from an open source implementation and since
toupper is pretty trivial and has a fairly limited set of reasonable
implementations it should be pretty close to whatever closed source
version you're using.
 
D

Default User

Noah said:
But you can always get it from an open source implementation and since
toupper is pretty trivial and has a fairly limited set of reasonable
implementations it should be pretty close to whatever closed source
version you're using.

Yes, which is what I recommended in the first place. Actually, a search
on the drive holding VC++ finds a TOUPPER.C file, which says:

*Purpose:
* Defines function versions of _toupper() and toupper().


So looks like it does provide at least some source.




Brian
 
N

Noah Roberts

Default said:
Yes, which is what I recommended in the first place. Actually, a search
on the drive holding VC++ finds a TOUPPER.C file, which says:

*Purpose:
* Defines function versions of _toupper() and toupper().


So looks like it does provide at least some source.

I think you get all the source with VS. You need it to view source
when debugging or you just end up stepping off the assembler cliff.
 
D

Default User

Noah said:
I think you get all the source with VS. You need it to view source
when debugging or you just end up stepping off the assembler cliff.

Yep, that's exactly what it does.

Never mind.




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top