• Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings!

    From Johann 'Myrkraverk' Oskarsson@johann@myrkraverk.invalid to comp.lang.c,comp.os.ms-windows.programmer.win32 on Sun Aug 9 05:39:34 2026
    From Newsgroup: comp.lang.c

    Dear comp.lang.c, comp.os.ms-windows.programmer.win32,

    and perhaps other groups that may make use of this information, but I
    don't know about.

    When you want to use == to compare strings such as "a", with "b" because
    all your strings are constants, please remember to add /GF to your
    CL.EXE command line. I have no idea how to do this in the IDE, but I'm
    sure you'll figure it out if you really have to.

    This kind of programming happens in small student projects, so be mind-
    ful of also telling your students about this, in the classroom.


    Best wishes, and happy string comparison with ==.
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From legalize+jeeves@legalize+jeeves@mail.xmission.com (Richard) to comp.lang.c,comp.os.ms-windows.programmer.win32 on Mon Aug 10 15:51:23 2026
    From Newsgroup: comp.lang.c

    From the documentation:

    "/GF is in effect when /O1 or /O2 is used."

    So... unless you are distributing debug executables, you're already
    getting this with typical release configurations.
    --
    "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
    The Terminals Wiki <http://terminals-wiki.org>
    The Computer Graphics Museum <http://computergraphicsmuseum.org>
    Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.lang.c,comp.os.ms-windows.programmer.win32 on Mon Aug 10 15:33:13 2026
    From Newsgroup: comp.lang.c

    legalize+jeeves@mail.xmission.com (Richard) writes:
    From the documentation:

    "/GF is in effect when /O1 or /O2 is used."

    So... unless you are distributing debug executables, you're already
    getting this with typical release configurations.

    The "announcement" was posted by "Johann", who is in my killfile,
    so I didn't see it. I knew he was an arrogant troll, but I didn't
    know that he posts deliberate misinformation aimed at inexperienced
    C programmers.

    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    The "/GF" option causes Visual Studio to share storage for identical
    string literals. It has no effect on strings other than string
    literals, so for example `s == "foo"` is still likely to fail.
    If you're writing code whose behavior depends on "/GF", you're
    almost certainly doing something wrong.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From R Kym Horsell@kym@sdf.org to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 04:02:50 2026
    From Newsgroup: comp.lang.c

    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    legalize+jeeves@mail.xmission.com (Richard) writes:
    From the documentation:

    "/GF is in effect when /O1 or /O2 is used."

    So... unless you are distributing debug executables, you're already
    getting this with typical release configurations.

    The "announcement" was posted by "Johann", who is in my killfile,
    so I didn't see it. I knew he was an arrogant troll, but I didn't
    know that he posts deliberate misinformation aimed at inexperienced
    C programmers.

    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    The "/GF" option causes Visual Studio to share storage for identical
    string literals. It has no effect on strings other than string
    literals, so for example `s == "foo"` is still likely to fail.
    If you're writing code whose behavior depends on "/GF", you're
    almost certainly doing something wrong.

    Kinda had a feel it was straight out of chatGPT or similar.
    --
    The next big move in software houses is firing all the engineers
    that cut code and hiring people to debug AI-generated code.

    Grindr CEO says AI is doing^h^h^hcreating work that would have required
    hiring 200 additional engineers
    Yahoo Finance, 8 Aug 2026 02:11
    Grindr CEO George Arison said that AI had increased its engineering output 2.5-fold.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 08:34:19 2026
    From Newsgroup: comp.lang.c

    On 11/08/2026 06:02, R Kym Horsell wrote:
    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    legalize+jeeves@mail.xmission.com (Richard) writes:
    From the documentation:

    "/GF is in effect when /O1 or /O2 is used."

    So... unless you are distributing debug executables, you're already
    getting this with typical release configurations.

    The "announcement" was posted by "Johann", who is in my killfile,
    so I didn't see it. I knew he was an arrogant troll, but I didn't
    know that he posts deliberate misinformation aimed at inexperienced
    C programmers.

    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    The "/GF" option causes Visual Studio to share storage for identical
    string literals. It has no effect on strings other than string
    literals, so for example `s == "foo"` is still likely to fail.
    If you're writing code whose behavior depends on "/GF", you're
    almost certainly doing something wrong.

    Kinda had a feel it was straight out of chatGPT or similar.


    I doubt it. AI's regularly make silly mistakes and hallucinate things,
    but in cases like this where the mistake turns up regularly in Stack
    Overflow and the like, I would not expect to see an AI get it wrong.
    AI's are quite good at summarising information from existing sources -
    it's when they are interpolating or extrapolating that they come up with bizarre things. So IMHO the post suggesting that comparing C strings
    with "==" is sometimes a good idea is human-generated - either someone
    who knows genuinely misunderstands the C language, or someone who is
    trolling.

    Of course, it is still possible that he used AI while posting. An AI is unlikely to suggest using "==" to compare strings in C, but it could get
    mixed up with other languages like C++ std::string comparison. And AI's
    tend to be sycophantic when asked for confirmation, so if you ask "Is it
    a good idea to use /GF when comparing strings with ==", then it can
    re-enforce a bad idea.


    In this poster's case, I am not sure. His posting style is highly
    anti-social and shows he does not read other people's posts and gives
    others no consideration at all - his posts are purely ego-centric. But
    he has also demonstrated that despite apparent long experience as a programmer, he misunderstands C in many aspects. He seems to base his programming knowledge on a "this worked for me" basis, rather than any
    kind of objective information. And since he has done this for a long
    time, he things he knows it all - he thinks his personal experience
    makes him an expert in the language and thus qualified to give advice to others and to sneer at people who /actually/ understand the language and
    how it works.

    This all makes him highly irritating to people who have put a lot of
    time and effort into understanding the language, and into helping others understand it (such as Keith). It makes him particularly dangerous to relative beginners who might mistake his misplaced self-confidence for authority, and believe what he writes.




    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 00:12:37 2026
    From Newsgroup: comp.lang.c

    David Brown <david.brown@hesbynett.no> writes:
    On 11/08/2026 06:02, R Kym Horsell wrote:
    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    legalize+jeeves@mail.xmission.com (Richard) writes:
    From the documentation:

    "/GF is in effect when /O1 or /O2 is used."

    So... unless you are distributing debug executables, you're already
    getting this with typical release configurations.

    The "announcement" was posted by "Johann", who is in my killfile,
    so I didn't see it. I knew he was an arrogant troll, but I didn't
    know that he posts deliberate misinformation aimed at inexperienced
    C programmers.

    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    The "/GF" option causes Visual Studio to share storage for identical
    string literals. It has no effect on strings other than string
    literals, so for example `s == "foo"` is still likely to fail.
    If you're writing code whose behavior depends on "/GF", you're
    almost certainly doing something wrong.
    Kinda had a feel it was straight out of chatGPT or similar.

    I doubt it.
    [snip]

    I suggest that it doesn't matter, and that we shouldn't waste time
    speculating about it.

    "Johann" is either an arrogant troll or a computer simulation of
    an arrogant troll. Either the person posting or the person running
    the bot likely craves attention. Let's not provide it.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From cross@cross@spitfire.i.gajendra.net (Dan Cross) to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 13:50:11 2026
    From Newsgroup: comp.lang.c

    In article <115ei17$3oq17$1@kst.eternal-september.org>,
    Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    David Brown <david.brown@hesbynett.no> writes:
    [snip]
    I doubt it.
    [snip]

    I suggest that it doesn't matter, and that we shouldn't waste time >speculating about it.

    "Johann" is either an arrogant troll or a computer simulation of
    an arrogant troll. Either the person posting or the person running
    the bot likely craves attention. Let's not provide it.

    Agreed. Please don't feed the troll.

    - Dan C.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.lang.c on Tue Aug 11 16:32:39 2026
    From Newsgroup: comp.lang.c

    On 2026-08-11 08:34, David Brown wrote:
    [...]

    I doubt it.-a AI's regularly make silly mistakes and hallucinate things,
    but in cases like this where the mistake turns up regularly in Stack Overflow and the like, I would not expect to see an AI get it wrong.

    AI's are quite good at summarising information from existing sources -
    it's when they are interpolating or extrapolating that they come up with bizarre things.-a[...]

    Yes, but the inherent problem with that is that this distinction is
    not necessarily decidable, identifiable or visible. Unless "obvious"
    you'd need own expertise or a second reliable information channel at
    least to be sure. And with a reliable channel, why using AI in the
    first place. I think use of AI is just convenience; a fast and single
    point of access for all topics. Though some folks really "trust" in
    AI. :-/

    Janis

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From legalize+jeeves@legalize+jeeves@mail.xmission.com (Richard) to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 15:10:13 2026
    From Newsgroup: comp.lang.c

    kymhorsell@gmail.com spake the secret code <115e6ta$120f$2@nnrp.usenet.blueworldhosting.com> thusly:

    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    Kinda had a feel it was straight out of chatGPT or similar.

    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.
    --
    "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
    The Terminals Wiki <http://terminals-wiki.org>
    The Computer Graphics Museum <http://computergraphicsmuseum.org>
    Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Anton Antimo@anton@safunu.org to comp.lang.c on Tue Aug 11 13:24:27 2026
    From Newsgroup: comp.lang.c

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 2026-08-11 08:34, David Brown wrote:
    [...]
    I doubt it.-a AI's regularly make silly mistakes and hallucinate
    things, but in cases like this where the mistake turns up regularly
    in Stack Overflow and the like, I would not expect to see an AI get
    it wrong.

    AI's are quite good at summarising information from existing sources
    - it's when they are interpolating or extrapolating that they come
    up with bizarre things.-a[...]

    Yes, but the inherent problem with that is that this distinction is
    not necessarily decidable, identifiable or visible. Unless "obvious"
    you'd need own expertise or a second reliable information channel at
    least to be sure. And with a reliable channel, why using AI in the
    first place. I think use of AI is just convenience; a fast and single
    point of access for all topics. Though some folks really "trust" in
    AI. :-/

    Indeed---fast, single point of access for all topics. Very useful when
    setting up your personal tools, for example. Why bother the local gurus
    when a machine can get us up to speed, hopefully letting us talk to the
    the community more interesting subjects? (Of course, there's always the
    unwise way of using everything.)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Charlie Gibbs@cgibbs@kltpzyxm.invalid to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 17:13:11 2026
    From Newsgroup: comp.lang.c

    On 2026-08-11, David Brown <david.brown@hesbynett.no> wrote:

    This all makes him highly irritating to people who have put a lot of
    time and effort into understanding the language, and into helping others understand it (such as Keith). It makes him particularly dangerous to relative beginners who might mistake his misplaced self-confidence for authority, and believe what he writes.

    "People who think they know everything annoy those of us who do." :-)
    --
    /~\ Charlie Gibbs | In this world there are
    \ / <cgibbs@kltpzyxm.invalid> | two kinds of people:
    X I'm really at ac.dekanfrus | 1. Those who can extrapolate
    / \ if you read it the right way. | from incomplete data.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 19:17:48 2026
    From Newsgroup: comp.lang.c

    Am 08.08.2026 um 23:39 schrieb Johann 'Myrkraverk' Oskarsson:
    Dear comp.lang.c, comp.os.ms-windows.programmer.win32,
    and perhaps other groups that may make use of this information, but I
    don't know about.
    When you want to use == to compare strings such as "a", with "b" because
    all your strings are constants, ...
    When do you compare the address of string literals ? I guess that's
    very rare. Today's compilers / linkers not only join string-literals
    on the same address when they're the same but any static data (comdat
    folding). The potential for mistakes with that seems very little for
    me.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Richard Harnden@richard.nospam@gmail.invalid to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 20:16:27 2026
    From Newsgroup: comp.lang.c

    On 11/08/2026 18:17, Bonita Montero wrote:
    Am 08.08.2026 um 23:39 schrieb Johann 'Myrkraverk' Oskarsson:
    Dear comp.lang.c, comp.os.ms-windows.programmer.win32,
    and perhaps other groups that may make use of this information, but I
    don't know about.
    When you want to use == to compare strings such as "a", with "b" because
    all your strings are constants, ...
    When do you compare the address of string literals ?

    When they've all come via a hash.

    I guess that's
    very rare. Today's compilers / linkers not only join string-literals
    on the same address when they're the same but any static data (comdat folding). The potential for mistakes with that seems very little for
    me.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c,comp.os.ms-windows.programmer.win32 on Tue Aug 11 14:30:55 2026
    From Newsgroup: comp.lang.c

    On 8/11/2026 8:10 AM, Richard wrote:
    kymhorsell@gmail.com spake the secret code <115e6ta$120f$2@nnrp.usenet.blueworldhosting.com> thusly:

    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    Kinda had a feel it was straight out of chatGPT or similar.

    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.

    Hopefully...
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From legalize+jeeves@legalize+jeeves@mail.xmission.com (Richard) to comp.lang.c,comp.os.ms-windows.programmer.win32 on Thu Aug 13 14:09:20 2026
    From Newsgroup: comp.lang.c

    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> spake the secret code <115g4af$b6pj$1@dont-email.me> thusly:

    On 8/11/2026 8:10 AM, Richard wrote:
    kymhorsell@gmail.com spake the secret code
    <115e6ta$120f$2@nnrp.usenet.blueworldhosting.com> thusly:

    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    Kinda had a feel it was straight out of chatGPT or similar.

    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.

    Hopefully...

    Sounds to me like you haven't used it for coding, or if you did, you
    haven't used it recently.
    --
    "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
    The Terminals Wiki <http://terminals-wiki.org>
    The Computer Graphics Museum <http://computergraphicsmuseum.org>
    Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c,comp.os.ms-windows.programmer.win32 on Thu Aug 13 14:39:03 2026
    From Newsgroup: comp.lang.c

    On 8/13/2026 7:09 AM, Richard wrote:
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> spake the secret code <115g4af$b6pj$1@dont-email.me> thusly:

    On 8/11/2026 8:10 AM, Richard wrote:
    kymhorsell@gmail.com spake the secret code
    <115e6ta$120f$2@nnrp.usenet.blueworldhosting.com> thusly:

    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    The troll's claim was that it's a good idea to use "/GF" in Visual
    Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers). C strings, whether literals or not,
    should be compared using strcmp() or something similar. The "=="
    operator will compare their addresses.

    Kinda had a feel it was straight out of chatGPT or similar.

    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.

    Hopefully...

    Sounds to me like you haven't used it for coding, or if you did, you
    haven't used it recently.

    No. I code myself. Btw, I have messed around with it and the bastard
    gave me some lock-free code that was simply infested with
    race-conditions! So, I kind of gave up on it.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c,comp.os.ms-windows.programmer.win32 on Thu Aug 13 14:41:19 2026
    From Newsgroup: comp.lang.c

    On 8/13/2026 2:39 PM, Chris M. Thomasson wrote:
    On 8/13/2026 7:09 AM, Richard wrote:
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> spake the secret
    code
    <115g4af$b6pj$1@dont-email.me> thusly:

    On 8/11/2026 8:10 AM, Richard wrote:
    kymhorsell@gmail.com spake the secret code
    <115e6ta$120f$2@nnrp.usenet.blueworldhosting.com> thusly:

    In comp.lang.c Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >>>>>> The troll's claim was that it's a good idea to use "/GF" in Visual >>>>>> Studio if you want to compare strings with "==".

    This is, of course, a remarkably bad idea (and a common error by
    inexperienced C programmers).-a C strings, whether literals or not, >>>>>> should be compared using strcmp() or something similar.-a The "==" >>>>>> operator will compare their addresses.

    Kinda had a feel it was straight out of chatGPT or similar.

    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.

    Hopefully...

    Sounds to me like you haven't used it for coding, or if you did, you
    haven't used it recently.

    No. I code myself. Btw, I have messed around with it and the bastard
    gave me some lock-free code that was simply infested with race-
    conditions! So, I kind of gave up on it.

    However, I did use it to teach me about some of the dx12 api's. It was
    pretty good there.
    --- Synchronet 3.22a-Linux NewsLink 1.2