• Re: Public Service Announcement: Please use /GF with Visual Studio when

    From Lawrence D?Oliveiro@3:633/10 to All on Tue Sep 1 21:20:10 2026
    Subject: Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings!

    On Tue, 11 Aug 2026 17:13:11 GMT, Charlie Gibbs wrote:

    "People who think they know everything annoy those of us who do."
    :-)

    Also: ?a little knowledge is a dangerous thing? -- the key point in
    that adage being the word ?little?.

    This phenomenon was quantified by psychology researchers ... let?s see
    ... names like ?Dunning? and ?Kruger? come to mind ...

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Wed Sep 2 02:46:31 2026
    Subject: Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings!

    On Tue, 11 Aug 2026 15:10:13 -0000 (UTC), Richard wrote:

    ChatGPT isn't that stupid and is more likely to alert you that you
    are doing a meaningless address compare than an actual string
    compare.

    There is this thing called ?interning? of strings, which is precisely
    to allow comparison of object addresses to substitute for comparison
    of the actual object contents.

    Java allows for this, for example. No reason why it couldn?t be
    implemented in C as well.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Keith Thompson@3:633/10 to All on Tue Sep 1 22:05:53 2026
    Subject: Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings!

    Lawrence D?Oliveiro <ldo@nz.invalid> writes:
    On Tue, 11 Aug 2026 15:10:13 -0000 (UTC), Richard wrote:
    ChatGPT isn't that stupid and is more likely to alert you that you
    are doing a meaningless address compare than an actual string
    compare.

    There is this thing called ?interning? of strings, which is precisely
    to allow comparison of object addresses to substitute for comparison
    of the actual object contents.

    Java allows for this, for example. No reason why it couldn?t be
    implemented in C as well.

    There are plenty of reasons why it can't be implemented in C, at least
    for all strings.

    There are existing string interning libraries in C, but they can't
    work on C strings in general. Such libraries can be useful, but
    They can only work on strings controlled by the library itself.

    #include <stdio.h>
    int main(void) {
    const char *lit = "hello";
    char greeting[] = "hello";
    if (greeting == lit) {
    puts("Wrong");
    }
    greeting[0] = 'H';
    if (greeting == lit) {
    puts("Even more wrong");
    }
    }

    Even `"hello" == "hello"` is unsafe (though apparently some compilers
    have options that can make it "work").

    This thread started because a lying troll claimed that it's a good idea
    to use "==" for C strings.

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)