Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, There is an issue in C coding that is bothering me. To create functions after the main function is required to define prototypes of them. I prefer this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    9

    C agile coding


    Hi all,

    There is an issue in C coding that is bothering me. To create functions after the main function is required to define prototypes of them. I prefer this approach in order to keep my code tidy. But I feel that I'm wasting time on doing all this boilerplate (and maybe ceremonial) code. You know some tool to support me with this sort of things?

    Currently I'm using emacs and cedet but I don't know such feature.

    best regards...

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,691
    Before you can use a function the code has to either see a prototype of the function call, or see the actual function definition. So, the answer is that you either put your functions where they will be seen by the compiler before you call them, or you need to provide the prototypes. This is not a step you can avoid. It is also why we have header files.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    May 2010
    Posts
    9
    Hi Rubberman,

    Thanks for your regards but I tought I wasn't fair enough with my problem. I already know the rules of the C language. Generally I prefer to put main function early in the code and other functions after it and define prototypes. But I want a tool that help me to create these prototypes automatically. Currently I need to write (indeed I copy and paste) prototypes. In java with eclipse IDE I have a bunch of tools that create this sort of code templates among other utilities to create boilerplate code. Do you know some tool like that?

    thanks...

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •