Re: XForms: strcmp

From: Ivan Powis (
Date: Thu Nov 23 2000 - 11:32:37 EST

  • Next message: Steve Lamont: "Re: XForms: spreadsheet??"

    # To subscribers of the xforms list from Ivan Powis <> :

    > # To subscribers of the xforms list from joel <> :
    > Actually, I'm looking for an empty string not if a pointer is null. So,
    > strcmp(string,"") works fine. I'm not sure why NULL works under
    > HPUX. I checked how its defined, and NULL = 0 under both OS's.
    > So maybe either the compiler or the implementation of strcmp under
    > HPUX views NULL as an empty string? Anyhow, as someone else
    > emailed me strcmp(string,"") is really what I meant to do and works
    > fine under both OS's.

    HPUX by default dereferences NULL pointers as you have seen exactly so
    that their use does not generate error traps. Thus your use of a NULL
    pointer to mean "" works fine on HP although it was surely wrong to
    write your particular example this way. This feature is sometimes
    "useful" for the non-rigorous programmer eg with a file selector which
    may return a null string if cancelled. A strcmp or similar can then
    check the returned string without needing to explicitly check for a
    null pointer return. I discovered this when porting some xforms apps
    from HP to Linux.


        ___  ___/   _  __ /   Ivan Powis   []
            /         /   /   School of Chemistry
           /         /  _/    University of Nottingham
          /         ___/      Nottingham NG7 2RD, UK
         /         /     TEL: +44-115-951-3467
        /         /      FAX: +44-115-951-3562
    _______/  ____/

    _________________________________________________ To unsubscribe, send the message "unsubscribe" to or see XForms Home Page: List Archive:

    This archive was generated by hypermail 2b29 : Thu Nov 23 2000 - 11:35:33 EST