Skip to content
This repository was archived by the owner on Apr 9, 2020. It is now read-only.

test: Fix declaration of main method#45

Merged
cabo merged 1 commit intocabo:masterfrom
beduino-project:fix-function-declaration
Feb 2, 2018
Merged

test: Fix declaration of main method#45
cabo merged 1 commit intocabo:masterfrom
beduino-project:fix-function-declaration

Conversation

@nmeum
Copy link
Contributor

@nmeum nmeum commented Feb 2, 2018

After reading cabos comment in #44 I wondered if cn-cbor actually compiles with C compilers other than gcc and clang and tested this by compiling it with pcc using the Simple-Makefile.

pcc complained that the function declaration for main in test.c is incorrect and according to section 5.1.2.2.1 of the C99 standard pcc is actually right about this.

@cabo cabo merged commit 2693645 into cabo:master Feb 2, 2018
@cabo
Copy link
Owner

cabo commented Feb 2, 2018

Not sure the test.c is particularly portable, as evidenced by

  system("leaks test");

(and the lack of a return...), but this should be an innocuous change.
Further portability fixes are welcome!

@nmeum
Copy link
Contributor Author

nmeum commented Feb 2, 2018

(and the lack of a return...)

Section 5.1.2.2.3 of the C99 standard states the following:

[...] reaching the } that terminates the main function returns a value of 0.

So you probably don't need a return statement in that function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants