# no warning about size\_t usage

**URL:** <https://forum.sierrawireless.com/t/no-warning-about-size-t-usage/4957>\
**Category:** Development tools\
**Created:** [March 15, 2011, 12:53pm UTC](https://forum.sierrawireless.com/t/no-warning-about-size-t-usage/4957 "2011-03-15T12:53:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zafer](https://avatars.discourse-cdn.com/v4/letter/z/439d5e/32.png) [@zafer](https://forum.sierrawireless.com/u/zafer)\
**Post date:** [March 15, 2011, 12:53pm UTC](https://forum.sierrawireless.com/t/no-warning-about-size-t-usage/4957/1 "2011-03-15T12:53:58Z")

</div>

Hi,  
I don’t know if it is related with DS or Compiler or somethingelse but i had a problem today.  
i skipped the point of comparing int and size\_t types in my code.

if(count \> strlen(myString1) - strlen(mystring2) )  
MyPrintFunc(“count is greater”);  
else  
MyPrintFunc(“count is less”);

where count=0, strlen(myString1)=12, strlen(myString2)=14 then  
I expected if(0 \> -2) case will be generated and “count is greater” message will be printed.  
But no. It generated if(0 \> 2) case. Because strlen return type is size\_t which is an unsigned interger. So it always takes possitive number.

This is my simple mispoint. i overlooked the case. But DS did not warm me about it. Shouldnt it warm about similar cases? Or All the responsibilities have been pushed on developers?

Thanks.

---

<div class="post-metadata">

**Author:** ![paruthiv](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@paruthiv](https://forum.sierrawireless.com/u/paruthiv)\
**Post date:** [April 13, 2011, 12:08pm UTC](https://forum.sierrawireless.com/t/no-warning-about-size-t-usage/4957/2 "2011-04-13T12:08:24Z")

</div>

Hi  
Yes,the warnings you receive are compiler dependent(based on the optimisation supported by the compiler).

Regards  
Paruthiv
