Giter Club home page Giter Club logo

Comments (2)

NimRo97 avatar NimRo97 commented on September 28, 2024

This was intended because I as the programmer do not like changing arguments within a function. I also wanted it to be clear that the dictionary used during computation does not necessarily have to be the same that we got in an argument (it can default to our EN). There is also a point to having this argument as const, because it shows the programmer, that the provided dictionary is not changed and this function indeed treats it like const. I am aware that this variable is omitted during compilation and I deliberately chose to include it nevertheless for the sake of the code.

I will mark this as not a bug, but thank you for the question. I would also like to hear your arguments for removing it because my point of view can be absolutely stupid and it may be irrelevant to most other developers :)

from pa193_mnemonic_bugsbunny.

AlexInsa avatar AlexInsa commented on September 28, 2024

Indeed, it is only one pointer more in the stack, it is not really important.

In addition, I agree that the it can add more legibility in the code. It is something really interesting because user could think that, if they give a pointer in parameter, and if the pointer is on NULL, then they would get the default dictionary at the end of the function execution.

For instance :

struct dictionary *dictionary = NULL;
int err = entropy_to_mnemonic(my_dico, entropy, entropy_l, &output);

The function, even if my_dico is NULL before, will not change the value of my_dico.
So, creating a local variable, to show that the dictionary used in the function has not any impact on the arguments, can be useful for beginner.

from pa193_mnemonic_bugsbunny.

Related Issues (8)

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.