implicit explicit

This is a discussion on implicit explicit within the C Programming forums, part of the General Programming Boards category; Whats the differance between calling a function explicitly and implicitly I know explicit means fully defined and implicit means partially ...

  1. #1
    Unregistered
    Guest

    implicit explicit

    Whats the differance between calling a function explicitly and implicitly I know explicit means fully defined and implicit means partially defined/implied but what would the different calls look like,
    also if a function does'nt return a value is it best to declare its return type to be void or just leave it blank.

    thanks guys.
    leaner wanting to be a master.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,656
    > implicit means partially defined/implied but what would the different calls look like
    Implicit declaration just means the compiler 'guesses' what the prototype for the function should have been, based on your first use of the function.

    So if you said
    foo ( 2 );

    The compiler would guess that the prototype should have been
    void foo ( int );

    This may or may not be actually correct, and even if it is, you should prototype the function.

    > also if a function does'nt return a value is it best to declare its return type to be void or just leave it blank
    Make it void

  3. #3
    Unregistered
    Guest
    Why make it void.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,656
    Because that's what "doesnt return a value" means

    If you leave it blank, that's the same as saying int (only it's an implicit int)

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Just cuz you are programming in c doesn't mean that the definitions of the words implicit and explicit have changed. When I say "you never do anything" I calling you lazy implicitly, whereas saying "you're lazy" is explicit. The compiler needs to know what a function is before you use it. Otherwise it will put how you used it into context. However, any compiler that just lets you implictly declare functions is one that needs to be thrown in the garbage. It is the programmers responsibility to tell the compiler what to do, not the compiler's responsibility to guess what the programmer was trying to do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interesting behavior with explicit copy constructor
    By Clairvoyant1332 in forum C++ Programming
    Replies: 1
    Last Post: 04-28-2008, 03:19 PM
  2. Replies: 6
    Last Post: 08-12-2007, 01:02 PM
  3. Explicit keyword
    By Mario F. in forum C++ Programming
    Replies: 5
    Last Post: 06-30-2006, 06:43 PM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Implicit and Explicit
    By ripper079 in forum C++ Programming
    Replies: 2
    Last Post: 09-06-2002, 12:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21