Skip to content

Conversation

@drfiemost
Copy link
Member

It doesn't error out here but the call is indeed wrong.

@drfiemost drfiemost requested a review from f00b4r0 April 18, 2025 19:15
@f00b4r0
Copy link
Member

f00b4r0 commented Apr 19, 2025

Good catch, how did that ever build? o_O

@samoht0
Copy link

samoht0 commented Apr 19, 2025

Building without error now, also resolves several warnings. Don't have hardware to test it.

@drfiemost drfiemost requested a review from mywave82 April 23, 2025 15:28
@mywave82
Copy link

@f00b4r0: Why did it not fail to compile?

When compiling C (not C++), and a function is not declared with parameters, nor void, the parameters are undefined:

#include <stdio.h>

void foo();
void bar(void);

int main(int argc, char *argv[])
{
        foo(1);
        bar(2);

        return 0;
}

Will only give error on the call to bar:

test2.c: In function ‘main’:
test2.c:9:9: error: too many arguments to function ‘bar’
    9 |         bar(2);
      |         ^~~
test2.c:4:6: note: declared here
    4 | void bar(void);
      |      ^~~

Copy link

@mywave82 mywave82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Adding a void in the header file would make it even more complete.

int xSfw_dlopen(void);
void xSfw_dlclose(void);

@f00b4r0
Copy link
Member

f00b4r0 commented Apr 23, 2025

@f00b4r0: Why did it not fail to compile?

When compiling C (not C++), and a function is not declared with parameters, nor void, the parameters are undefined:

Got it, it "worked" because we're building with a C++ compiler. Thanks.

@f00b4r0 f00b4r0 merged commit 99bfaf2 into master Apr 23, 2025
3 checks passed
@drfiemost drfiemost deleted the issue_4 branch April 24, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants