Open IngwiePhoenix opened 10 years ago
As far as I see from your backtrace, your struct ucl_parser *
pointer has different values:
ucl_state_machine(parser=0x0000000100200000)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ucl_parser_register_variable(parser=0x00007fff5fbfdaf0, var=0x00007fff5fbfd8d0, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Obviously, it is not correct.
Turns out the way I had passed the parser as user-data was not right. I used &parser
- but was supposed to cast it to void* instead. now it works. :)
"Yo Dawg, I heard you like C++, so I added C++ to your build system, so you have to compile before you compile.“ -StackOverflow, Matt Joiner ( http://stackoverflow.com/a/5025525/2423150 )
Am 08.05.2014 um 22:45 schrieb Vsevolod Stakhov notifications@github.com:
As far as I see from your backtrace, your struct ucl_parser * pointer has different values:
ucl_state_machine(parser=0x0000000100200000) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ucl_parser_register_variable(parser=0x00007fff5fbfdaf0, var=0x00007fff5fbfd8d0, ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Obviously, it is not correct.
— Reply to this email directly or view it on GitHub.
If you use C++, then you always need reinterpret_cast
to void *
to interact with C. This is the most ugly requirement, but it comes from C not from C++.
Okay, I then just cheated. XD
(void*)parser;
And got no error.
"Yo Dawg, I heard you like C++, so I added C++ to your build system, so you have to compile before you compile.“ -StackOverflow, Matt Joiner ( http://stackoverflow.com/a/5025525/2423150 )
Am 09.05.2014 um 11:30 schrieb Vsevolod Stakhov notifications@github.com:
If you use C++, then you always need reinterpret_cast to void * to interact with C. This is the most ugly requirement, but it comes from C not from C++.
— Reply to this email directly or view it on GitHub.
C style cast works exactly the same as C++ reinterpret_cast
, however, it breaks C++ types interface and auto
in particular, hence I'd not recommend to use C style casts in C++.
Hey. I wanted to implement a .var macro. In fact, I sat down and wrote a small math algorithm that'd find the key and value for me (which works!). However, when I then try to call register_variable, I get a segfault. Here is what the debugger pointed me to:
The function from which I am calling this:
key and value are properly NULL terminated, at least they should be! I see nothing that says different with the printfs. But during variable registration, I get the segfault.
Any soltution?