Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #400964

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

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c, comp.os.ms-windows.programmer.win32
Subject Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings!
Date 2026-08-11 08:34 +0200
Organization A noiseless patient Spider
Message-ID <115efpb$3o7ie$1@dont-email.me> (permalink)
References <smNdS.557$7WX8.434@fx08.ams4> <115cs1r$1q2i3$1@news.xmission.com> <115djjf$3g75j$2@kst.eternal-september.org> <115e6ta$120f$2@nnrp.usenet.blueworldhosting.com>

Cross-posted to 2 groups.

Show all headers | View raw


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.



Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-09 05:39 +0800
  Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! legalize+jeeves@mail.xmission.com (Richard) - 2026-08-10 15:51 +0000
    Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-08-10 15:33 -0700
      Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! R Kym Horsell <kym@sdf.org> - 2026-08-11 04:02 +0000
        Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! David Brown <david.brown@hesbynett.no> - 2026-08-11 08:34 +0200
          Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-08-11 00:12 -0700
            Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! cross@spitfire.i.gajendra.net (Dan Cross) - 2026-08-11 13:50 +0000
          Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-08-11 16:32 +0200
            Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Anton Antimo <anton@safunu.org> - 2026-08-11 13:24 -0300
          Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2026-08-11 17:13 +0000
        Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! legalize+jeeves@mail.xmission.com (Richard) - 2026-08-11 15:10 +0000
          Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-08-11 14:30 -0700
            Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! legalize+jeeves@mail.xmission.com (Richard) - 2026-08-13 14:09 +0000
              Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-08-13 14:39 -0700
                Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-08-13 14:41 -0700
  Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Bonita Montero <Bonita.Montero@gmail.com> - 2026-08-11 19:17 +0200
    Re: Public Service Announcement: Please use /GF with Visual Studio when you want to collapse constant strings! Richard Harnden <richard.nospam@gmail.invalid> - 2026-08-11 20:16 +0100

csiph-web