Coder Social home page Coder Social logo

Comments (4)

lionfaith avatar lionfaith commented on June 1, 2024

Note that putting void for the arguments removes the warning. That is void empty_func(void) instead of void empty_func().

from orangec.

bencz avatar bencz commented on June 1, 2024

Hi @lionfaith!
I send a pull request to David, with the correction of this problem, take a look in pull #18

from orangec.

LADSoft avatar LADSoft commented on June 1, 2024

Hi Lionfaith,

yes that is expected, emptyfunc() is different from emptyfunc(void) in
the C language (because the former actually allows you to put any number
of arguments in the call whereas the latter allows you to put none).
The disparity between those is part of the reason for the warning.

In C++ that was changed so that the two prototypes are equivalent.

Bencz's change fixes the problem but I think it has unintended side
effects. It may not properly issue errors if the argument types don't
match the parameter types.

After some playing around with mingw32-cc I decided to leave the warning
but demote it to a 'trivial' warning so it won't show up unless you ask
for it.

I will have a new release within the next couple of days.

David

lionfaith wrote:

Note that putting |void| for the arguments removes the warning. That
is |void empty_func(void)| instead of |void empty_func()|.


Reply to this email directly or view it on GitHub
#17 (comment).

from orangec.

lionfaith avatar lionfaith commented on June 1, 2024

Hi David,
thanks for your nice answer with my mistake.

C is confusing and even experienced programmer makes the mistake as I could read on stackoverflow. I just tested the same code on this online compiler with Clang and Gcc. And here I could test with msvc. Apparently, none of them complains about empty_func().

Thanks to you @bencz for your quick response.

from orangec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.