Results 1 to 5 of 5

Thread: How to avoid the warnings "implicit declaration"

  1. #1
    Join Date
    May 2008
    Posts
    923

    How to avoid the warnings "implicit declaration"

    I'm working on a project in C and I have some time of warnings like this one :

    Warning.c: 54: Attention: implicit declaration of function 'isblank'

    I do not understand what it means and I do not necessarily correct. The program seems to behave as desired, but I would like this code is clean. Could you inform me?

  2. #2
    Join Date
    May 2008
    Posts
    271

    Re: How to avoid the warnings "implicit declaration"

    Is the function isblank () and its lines of code, are before or after the call to this function? It seems that the code isblank () is after his appeal (in which case it would change up the lines of code), or that is in another file, and it lacks a statement of "prototype" for this function (in which case it would add a prototype).

  3. #3
    Join Date
    May 2008
    Posts
    685

    Re: How to avoid the warnings "implicit declaration"

    #include <ctype.h>

    it should work better. In C you have to #include the corresponding functions used. If in doubt, better to put too much than not enough.

    As against C, in the strict sense of language, any function that returns an integer can be used without declaration, which is why you have a warning and not an error, but it is not recommended.

  4. #4
    Join Date
    May 2008
    Posts
    945

    Re: How to avoid the warnings "implicit declaration"

    This means that you call a function without having provided a prototype first. The compiler then assumptions about the type of parameters and the return. It does not check whether the number of parameters is consistent. The behavior is unspecified.

    To code correctly, you need to provide a prototype. the role header (.h) contain precisely the prototypes of functions.

    Code:
    #include <ctype.h>

  5. #5
    Join Date
    May 2008
    Posts
    685

    Re: How to avoid the warnings "implicit declaration"

    The compiler performs exactly one and only one assumption: that the return type is integer. The behavior is determined: the return value will be caste bit-by-bit from an integer. The parameters are always passed in any way in C you can pass anything as a parameter.

Similar Threads

  1. Replies: 3
    Last Post: 03-02-2012, 05:26 PM
  2. Replies: 2
    Last Post: 10-01-2012, 05:45 PM
  3. Replies: 3
    Last Post: 30-10-2009, 06:27 PM
  4. Difference between Implicit and Explicit Declaration
    By vinodpathak_214 in forum Software Development
    Replies: 3
    Last Post: 16-01-2009, 10:00 AM
  5. Replies: 6
    Last Post: 21-06-2007, 12:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,559,049.77799 seconds with 17 queries