5

https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp

Line 22 => Where is declare "ScriptError" ? What does the "*" mean ?

           "inline bool set_success(ScriptError* ret)"

1 Answer 1

8

The enum ScriptError is defined in https://github.com/bitcoin/bitcoin/blob/master/src/script/script_error.h, and the * means that set_success requires you to pass a pointer to an enum value rather than the enum value itself.

I have to tell you, however, that if you are asking questions like "What does the "*" mean?", then you are going to have a hard time understanding C++ code. I highly recommend doing some tutorials on C++ programming before going any further.

5
  • I know about pointers I was just disturbed by the fact that it is wrote "ScriptError*" and not "*ScriptError"
    – smoumou
    Jun 27, 2016 at 17:11
  • *ScriptError would mean dereferencing a variable named "ScriptError". For example, see line 25 interpreter.cpp, where ret is dereferenced in order to assign a new value. I think you are thinking of writing set_success(ScriptError* ret) like set_success(ScriptError *ret), instead. In C++, both mean the same thing.
    – Jestin
    Jun 27, 2016 at 17:22
  • Do you understand what is happening line 167 ?
    – smoumou
    Jun 28, 2016 at 11:13
  • std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - 1);
    – smoumou
    Jun 28, 2016 at 11:16
  • It's creating a copy of vchSig called vchSigCopy. However, it's neither possible nor appropriate for me to teach you C++ in the comments. Some of these questions you've been asking are very fundamental concepts in C++. You really need to take some time to learn the language if you want to understand Bitcoin's code.
    – Jestin
    Jun 28, 2016 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.