warning: control reaches end of non-void function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnsimp12
    New Member
    • Apr 2013
    • 1

    warning: control reaches end of non-void function

    I keep getting 'warning: control reaches end of non-void function' with this code:

    Code:
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
     if (section ==0)
    
     {
      return [comparativeList count];
     }
    
     if (section==1) 
     {
      return [generalList count];
     }
    
     if (section==2)
     {
    
      return [contactList count];
    How can I get rid of this warning?

    Thanks.
    Last edited by Rabbit; Apr 26 '13, 03:52 PM. Reason: Please use code tags when posting code.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Your code looks OK which line of the code do you get that error on?

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      This code looks OK. You may be missing a ; earler in the code.

      Remember, the error location is where the compiler knew it was in trouble. The real error is anywhere from there to the beginning of your.c file including all of your #include files.

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Put a return at the end of the function returning some sensible 0 value.

        And please don't make major edits to your post after please have replied, it makes the thread make no sense. Just add another reply to the thread.

        Comment

        Working...