7 Replies - 724 Views - Last Post: 28 February 2008 - 11:37 AM Rate Topic: -----

#1 computer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-February 08

source code

Post icon  Posted 27 February 2008 - 10:47 AM

actually i want to have the source code for the library function of string length .i want to know that what is the code behind the string length function and i want to know that from where i can get the codes of other functions
Is This A Good Question/Topic? 0
  • +

Replies To: source code

#2 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: source code

Posted 27 February 2008 - 11:19 AM

Like, you're looking for a download of the source code for the C++ Standard Library?

Or are you looking for C?
Was This Post Helpful? 0
  • +
  • -

#3 computer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-February 08

Re: source code

Posted 28 February 2008 - 04:54 AM

View Postcomputer, on 27 Feb, 2008 - 10:47 AM, said:

actually i want to have the source code for the library function of string length .i want to know that what is the code behind the string length function and i want to know that from where i can get the codes of other functions

i want to have the code in c++.
Was This Post Helpful? 0
  • +
  • -

#4 Nayana  Icon User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 31
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: source code

Posted 28 February 2008 - 05:27 AM

Well it depends.

In C++, a string object stores the number of characters in an int. So the code for size() would simply be return charCount, or something like that.

For the size of a cstring that is a char[] or a char * then basically the code to check the size just starts at the beginning of the array/pointer (pretty much the same thing) and keeps counting the bytes forever until it reaches a NUL char ((char)0).
Was This Post Helpful? 0
  • +
  • -

#5 computer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-February 08

Re: source code

Posted 28 February 2008 - 05:33 AM

View PostNayana, on 28 Feb, 2008 - 05:27 AM, said:

Well it depends.

In C++, a string object stores the number of characters in an int. So the code for size() would simply be return charCount, or something like that.

For the size of a cstring that is a char[] or a char * then basically the code to check the size just starts at the beginning of the array/pointer (pretty much the same thing) and keeps counting the bytes forever until it reaches a NUL char ((char)0).

thank u so much for helping me
Was This Post Helpful? 0
  • +
  • -

#6 AmitTheInfinity  Icon User is offline

  • C Surfing ∞
  • member icon

Reputation: 119
  • View blog
  • Posts: 1,563
  • Joined: 25-January 07

Re: source code

Posted 28 February 2008 - 05:58 AM

View Postcomputer, on 27 Feb, 2008 - 11:17 PM, said:

actually i want to have the source code for the library function of string length .i want to know that what is the code behind the string length function and i want to know that from where i can get the codes of other functions



This sounds interesting, specially when a computer is asking for source code instead of executables :lol:
Was This Post Helpful? 0
  • +
  • -

#7 Nayana  Icon User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 31
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: source code

Posted 28 February 2008 - 06:07 AM

If you care a lot, all the standard C/C++ libraries have open-source implementations. Think GNU. So it is possible to find the source code, but you'll have to use Google for that one.

View PostAmitTheInfinity, on 28 Feb, 2008 - 08:58 PM, said:

This sounds interesting, specially when a computer is asking for source code instead of executables :lol:

Well, wadda ya know? There is an operating system that only runs source code (scripts).

This post has been edited by Nayana: 28 February 2008 - 06:03 AM

Was This Post Helpful? 0
  • +
  • -

#8 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: source code

Posted 28 February 2008 - 11:37 AM

View PostNayana, on 28 Feb, 2008 - 07:07 AM, said:

If you care a lot, all the standard C/C++ libraries have open-source implementations. Think GNU. So it is possible to find the source code, but you'll have to use Google for that one.

View PostAmitTheInfinity, on 28 Feb, 2008 - 08:58 PM, said:

This sounds interesting, specially when a computer is asking for source code instead of executables :lol:

Well, wadda ya know? There is an operating system that only runs source code (scripts).


I wasn't sure if glibc was C only or C and C++. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1