Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 241,356 of 243,242    |
|    Lawrence =?iso-8859-13?q?D=FFOlivei to pozz    |
|    Re: signed vs unsigned and gcc -Wsign-co    |
|    20 Oct 25 23:35:35    |
   
   From: ldo@nz.invalid   
      
   On Mon, 20 Oct 2025 17:03:58 +0200, pozz wrote:   
      
   > What about other situations? For example, what do you use for the "i"   
   > loop variable?   
      
   I use unsigned integers if negative values are not involved, where the   
   extra positive values might be useful. Here’s an example of the kind   
   of loop I might write:   
      
    unsigned int i;   
    bool found;   
    for (i = len(s);;)   
    {   
    if (i == 0)   
    {   
    found = false;   
    break;   
    } /*if*/   
    if (matches(s[i]))   
    {   
    found = true;   
    break;   
    } /*if*/   
    --i;   
    } /*for*/   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca