Skip to content

Something funny going on with extern double pointers #3898

Closed
@eevee

Description

@eevee

0.4.

boolnames is a global array-of-char* that curses provides. (It's actually declared as extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];.)

https://gist.github.com/3995350

The C version spits out the entire array, starting with:

0x600aa0 0x7f6eb0dcd831 b bw
0x600aa8 0x7f6eb0dd5703 a am
0x600ab0 0x7f6eb0dd6199 x xsb

The Rust version spits out:

7f7a9ec58831 7378006278007762

...and then segfaults trying to evaluate **p. Cursory inspection reveals that the value given for *p is actually the string bw\0xb\0xs. Somehow the first level of indirection is disappearing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions