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


Groups > comp.lang.c > #147705

Re: What are the odds? (a continuation of One works ...)

Subject Re: What are the odds? (a continuation of One works ...)
Newsgroups comp.lang.c
References (4 earlier) <voGwF.93833$vD7.57507@fx06.iad> <g4g6se5u1ggsmecioggck2k7ve59pfdbbp@4ax.com> <2VHwF.97943$_i.39059@fx25.am4> <ln36f05q6t.fsf@kst-u.example.com> <h2hhf7Fq967U11@mid.individual.net>
From Bart <bc@freeuk.com>
Message-ID <0OSwF.55314$_d3.10705@fx38.am4> (permalink)
Organization virginmedia.com
Date 2019-11-07 10:59 +0000

Show all headers | View raw


On 07/11/2019 03:30, Ian Collins wrote:
> On 07/11/2019 16:19, Keith Thompson wrote:

>> The only thing the code does that depends on charset containing a
>> valid string is the single (incorrect) call to strlen().  If you
>> replace `strlen(charset)` by `sizeof charset` then there's no need
>> to nul-terminate it.

> Or do what I did in my C++ version and use a compile time constant for 
> the size.  That way the compile will break if you miss out a character.

What does that look like?

With a specified bound, C is only interested if you have too many 
characters, not too few.

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


Thread

Re: What are the odds? (a continuation of One works ...) Barry Schwarz <schwarzb@delq.com> - 2019-11-06 14:23 -0800
  Re: What are the odds? (a continuation of One works ...) Bart <bc@freeuk.com> - 2019-11-06 22:35 +0000
    Re: What are the odds? (a continuation of One works ...) luser droog <luser.droog@gmail.com> - 2019-11-06 17:09 -0800
    Re: What are the odds? (a continuation of One works ...) Keith Thompson <kst-u@mib.org> - 2019-11-06 19:19 -0800
      Re: What are the odds? (a continuation of One works ...) Ian Collins <ian-news@hotmail.com> - 2019-11-07 16:30 +1300
        Re: What are the odds? (a continuation of One works ...) Bart <bc@freeuk.com> - 2019-11-07 10:59 +0000
        Re: What are the odds? (a continuation of One works ...) David Brown <david.brown@hesbynett.no> - 2019-11-07 14:27 +0100
  Re: What are the odds? (a continuation of One works ...) DFS <nospam@dfs.com> - 2019-11-06 18:09 -0500
    Re: What are the odds? (a continuation of One works ...) Keith Thompson <kst-u@mib.org> - 2019-11-06 19:26 -0800
      Re: What are the odds? (a continuation of One works ...) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-07 11:57 +0000

csiph-web