After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 584575 - Testing out string variable always succeeds
Testing out string variable always succeeds
Status: RESOLVED DUPLICATE of bug 591673
Product: vala
Classification: Core
Component: Code Generator
0.7.x
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-06-02 01:55 UTC by Jim Nelson
Modified: 2010-01-29 21:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jim Nelson 2009-06-02 01:55:44 UTC
Please describe the problem:
When an out string variable is passed to a function, testing if it's null always succeeds.  It's because the generated code checks if what's being pointed to is null (which is set when the function begins) rather than the pointer itself.

Steps to reproduce:

void func1(out string? s) {
    if (s != null)
        s = "bar";
}

void main() {
    string foo;
    func1(out foo);
    stdout.printf("%s\n", foo);
}

This code never prints "bar", which I expect it to.  Removing the null test in func1 will make this work.

Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Jürg Billeter 2010-01-29 21:11:22 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 591673 ***