Re: [1/2] include: Implement part of nserror.h

2013-03-10 Thread Nikolay Sivov

On 3/11/2013 10:27, Jeff Latimer wrote:

---
  include/nserror.h | 226
++
  1 file changed, 226 insertions(+)
  create mode 100644 include/nserror.h
+#ifndef _NSERROR_H
+#define _NSERROR_H

This doesn't look right.


+#define NS_S_CALLPENDING_HRESULT_TYPEDEF_(0x000DL)

This is usually done with a suffix.


+
+#endif

Please add a comment here.




Re: msvcp60: Avoid signed-unsigned integer comparisons

2013-03-10 Thread Max TenEyck Woodbury

On 03/10/2013 07:00 AM, Henri Verbeet wrote:

On 10 March 2013 08:20, larmbr zhan  wrote:


But It behaves different when it is signed or not.  According to
C Standard,

>>

-  For the signed case, once it overflows, resulting in
   representing a  negative value .


Actually, signed overflow behavior is undefined according to the
standard.


Specifically, some hardware throws an exception on signed arithmetic
overflow and C is specifically designed to be hardware independent, so
it has to be 'undefined behavior'.


   -  For the unsigned case,  once it overflows, resulting in
  representing a value reduced modulo the largest value
  that object could hold.


Nit: modulo the largest value the object can hold _plus one_, but it 
should be treated as another 'undefined behavior'.


To further complicate the issue, while size_t is always unsigned, size_t 
can be 16, 18, 32, 36 or 64 bits and still be compliant.  So use

'size_t' when you are talking about the size of something, and
'unsigned' for flag sets and counts.




Re: msvcp60: Avoid signed-unsigned integer comparisons

2013-03-10 Thread Henri Verbeet
On 10 March 2013 08:20, larmbr zhan  wrote:
>But It behaves different when it is signed or not.  According to C 
> Standard,
>-  For the signed case, once it overflows, resulting in
> representing a negative value .

Actually, signed overflow behaviour is undefined according to the standard.