Issue Details (XML | Word | Printable)

Key: PCC-161
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: j sanchez
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

function declared without specifying arguments.

Created: 25/Jun/10 01:10 PM   Updated: 01/May/14 05:02 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Environment: OpenBSD


 Description  « Hide
   I'm having some issues with the tricky function declaration without
specific arguments (func()) and PCC. It seems like the declaration makes
PCC think in the function as it's allowed to receive arguments while the
definition says not.

here is the example code to this:

------------------------------------------------------------------------
#include <stdio.h>

int fa(); // declare fa() as "don't know about arguments"

int fa(void){ // define fa() as no arguments
   return 1;
}

int main(){

   int a=fa(1); // PCC allows this as thinks in fa() not fa(void)

   return 0;
}
------------------------------------------------------------------------

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson made changes - 01/May/14 05:01 PM
Field Original Value New Value
Assignee Anders Magnusson [ ragge ]
Anders Magnusson added a comment - 01/May/14 05:02 PM
Now prototypes declared by functions will also override definitions.

Anders Magnusson made changes - 01/May/14 05:02 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]