Thread: C , Objetive C, And C++

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    18

    C , Objetive C, And C++

    1. What is the different between Objective C and Normal C?? ( To my understanding they are just a different way of using the C language )

    2. Where can i read more about the future of C++, Since i read a article about the crtics of C++, and i see there are still much can be done about C++ to truely replace C.

    3. Something i don't understand is that Why no OS is programmed in C++??

    4. Is C still being developed like C++ or has all resource gone to C++??

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    1) Objective C is C, with OOP.. isn't it?

    3) ASM is needed for the boot loader... but are you sure that there aren't any OSes programmed at least partially in C++?
    Away.

  3. #3
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    Windows, from what I hear is programmed in some C++
    Linux is programmed in mostly C
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  4. #4
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    why is this in the tech board?
    PHP and XML
    Let's talk about SAX

  5. #5
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    objective C is a completely different programming language that nobody ever uses. afaik it is used for developing on macs, but I don't care about macs or objective c a whole hell of a lot.

  6. #6
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    Originally posted by Waldo2k2
    why is this in the tech board?
    Why are you a thread nazi?

    objective C is a completely different programming language that nobody ever uses. afaik it is used for developing on macs, but I don't care about macs or objective c a whole hell of a lot.
    Completely different? How about C with OPP. Can you point out a differce(where it will break C instead if bending)?

    No one does seem to use it... Anyone here?

  7. #7
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>Why are you a thread nazi?

    NO SOUP FOR YOU! (sorry, couldn't resist a Seinfeld plug)

    I was just asking why it was in here, seems like there's been a lot of programming questions in this board lately.

    >>Windows, from what I hear is programmed in some C++

    I think it's still mostly in C though...but I'm not sure about XP or the longhorn project. I'm betting longhorn would be more C++ or .NET or something higher level.
    PHP and XML
    Let's talk about SAX

  8. #8
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Windows is written in many languages. Depends on who they can find to steal the code off.

    http://www.geocrawler.com/archives/3...0/9/0/4385765/

  9. #9
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    NO SOUP FOR YOU!


    I was just asking why it was in here, seems like there's been a lot of programming questions in this board lately
    O, ok. I was sure if you were nazi or not.

    Alot of Windows is supposed to be on >NET for the next one. No idea why but slashdot had something about this awhile ago.

    Id like to think that MS using it means its that good, but I cant help being a little skeptical about it.

    This site is(was/will be again) pretty popular, do we have any MS people here(association with the company like workers/contracters)?

  10. #10
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Completely different? How about C with OPP. Can you point out a differce(where it will break C instead if bending)?

    Driver program in Objective C...I don't know how many times I have to tell you Objective C is not C or C++, it is its own language

    Code:
    int main (void)
    {
        /* First create instances of "Stack" and "Queue" data structures.  */
        id queue = [[Queue alloc] init];
        id stack = [[Stack alloc] init];
        int i, reply;
        
        fprintf (stderr, "Include the Char class in the demo? (y/n): ");
    
        /* Anything not matching `y.*' means no.  */
        reply = getchar ();
    
        for (i = 5; i > -6; --i)
          {
    	/* Depending on which version of the demo we're running, we
    	   alternately put Ints and Floats onto the queue and stack, or
    	   Ints, Floats, and Chars.  */
    	if (reply == 'y')
    	  {
    	    /* If I is odd we put an Int on the queue and a Char on the
    	       stack.  If I is even we put an Char on the queue and a Float
    	       on the stack.
    
    	       Since there is more than one method `-init:' and since
    	       `+alloc' returns a plain, typeless, `id', the compiler
    	       doesn't know the type of the object returned by alloc.  An
    	       explicit cast (i.e. static type indication) ensures that the
    	       compiler knows which `init:' is invoked---the one accepting a
    	       char or the other one accepting an int.
    
    	       Another solution, which avoids the static type indication, is
    	       to put typing information on the method in the method's name.
    	       This is done for the Float class.  */
    	    id my_char = [(Char *) [Char alloc] init: 'm' + i];
    
    	    if (i & 1)
    	      {
    		[queue put: [(Int *) [Int alloc] init: i]];
    		[stack put: my_char];
    	      }
    	    else
    	      {
    		[queue put: my_char];
    		[stack put: [[Float alloc] initFloatValue: i]];
    	      }
              }
    	else
    	  {
    	    /* If I is odd we put an Int on the queue and a Float on the
    	       stack.  If I is even we put a Float on the queue and an Int
    	       on the stack.  */
                [queue put: ((i & 1)
    			 ? [(Int *) [Int alloc] init: i]
    			 : [[Float alloc] initFloatValue: i])];
                [stack put: ((i & 1)
    			 ? [[Float alloc] initFloatValue: i]
    			 : [(Int*) [Int alloc] init: i])];
    	}
        }
    
        while ([queue size] && [stack size])
          {
    	/* The following illustrates run-time binding.  Will report be
    	   invoked for a Float object or an Int object?  Did the user elect
    	   for Char objects at run time?  We don't know ahead of time, but
    	   with run-time binding and polymorphism it works properly.  The
    	   burden is on the class implementer rather than the class user.
    
    	   Note that the following lines remain unchanged, whether we are
    	   using the Char class or not.  The queue and stack hand us the
    	   next object, it reports itself regardless of its type, and then
    	   it frees itself.  */
    
    	printf ("queue:");
    	[[[queue get] report] free];
    	printf (", stack:");
    	[[[stack get] report] free];
    	putchar('\n');
          }
      return 0;
    }

  11. #11
    Registered User Grayson_Peddie's Avatar
    Join Date
    May 2002
    Posts
    96
    Silvercord, the int only accepts numbers. Use "char" for reply.
    View in Braille.
    http://www.future-gpnet.com/braille.jpg

    Like a bolt out of the BLUE,
    Fate steps up and sees you THROUGH,
    When you wish upon a STAR
    YOUR DREAMS COME TRUE.

  12. #12
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    what in the HELL are you talking about.

    it's perfectly legal to do things like:

    for (int x = 'a'; x < 26; x++)
    checkdrive(x);

    that's how games check for cd drives

  13. #13
    Registered User Grayson_Peddie's Avatar
    Join Date
    May 2002
    Posts
    96
    Here's the code:

    Code:
        int i, reply;
        
        fprintf (stderr, "Include the Char class in the demo? (y/n): ");
    
        /* Anything not matching `y.*' means no.  */
        reply = getchar ();
    
        for (i = 5; i > -6; --i)
          {
    	/* Depending on which version of the demo we're running, we
    	   alternately put Ints and Floats onto the queue and stack, or
    	   Ints, Floats, and Chars.  */
    	if (reply == 'y')
    The "reply" variable is an integer data type. You should replace it with:

    Code:
        int i; char reply;
        
        fprintf (stderr, "Include the Char class in the demo? (y/n): ");
    
        /* Anything not matching `y.*' means no.  */
        reply = getchar ();
    
        for (i = 5; i > -6; --i)
          {
    	/* Depending on which version of the demo we're running, we
    	   alternately put Ints and Floats onto the queue and stack, or
    	   Ints, Floats, and Chars.  */
    	if (reply == 'y')
    View in Braille.
    http://www.future-gpnet.com/braille.jpg

    Like a bolt out of the BLUE,
    Fate steps up and sees you THROUGH,
    When you wish upon a STAR
    YOUR DREAMS COME TRUE.

  14. #14
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    As silvercord pointet out, the code is perfectly legal.

    'y' is just a different literal representation of 121. Did you ever wonder why there are signed and unsigned chars ?

    btw, "y" would be something different.
    [code]

    your code here....

    [/code]

Popular pages Recent additions subscribe to a feed