Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: "um" <dont_email@xxxxxxxxxx>
- Date: Wed, 20 Apr 2005 06:18:20 +0200
"Doug Harrison [MVP]" wrote
> On Tue, 19 Apr 2005 15:34:05 +0200, um wrote:
>
> > The code is not broken. In your quote you have left out the
> > relevant part of the code.
> > It is not perror which sets errno (funny imagination, btw).
> > errno is set by sem_trywait(). The code is:
> >
> > assert((result = sem_trywait(&s)) == -1);
> > if ( result == -1 )
> > {
> > perror("thread: sem_trywait 1: expected error"); // No error
> > assert(errno == EAGAIN);
>
> David was correct in his reply to you. Absent documentation to the
> contrary, standard library functions are free to set errno to non-zero
> values. Thus, your assert is based on the faulty expectation that perror
> preserves errno (which you assume equals EAGAIN) or sets it to EAGAIN
> itself.
Please see my followup to his posting. Even after changing it
the error still remains.
And: how do you explain the fact that compilers other than VC++2005
don't generate any error, incl. MS VC++6 and GNU ?
FYI: there are 122 test programs in total. All tests are passed with
the other compilers (incl. VC++6), except that VC++2005 fails with 26 of them.
Any thoughts on what might be the reason for such behaviour
between VC++6 and VC++2005 ?
>In addition, you originally posted:
>
> void *
> thr(void * arg)
> {
> sem_t s;
> int result;
>
> assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
>
> assert((result = sem_trywait(&s)) == -1);
>
> if ( result == -1 )
>
> <snip>
>
> That's just wrong, because nothing initializes s and result when NDEBUG is
> defined, i.e. in a release build. You must never put code that is part of
> your program's logic in asserts. You need to rethink your error handling
> strategy.
Right, but: these are a set of standard test programs to be run only
in debug mode. They are compiled AND executed collectively via a make file.
They are not intended to be used otherwise. They test whether
the library does function as expected on the given platform.
They are part of the pthreads distribution, not mine.
.
- Follow-Ups:
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: David Schwartz
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: Doug Harrison [MVP]
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- References:
- VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: Carl Daniel [VC++ MVP]
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: David Schwartz
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: Doug Harrison [MVP]
- VC++ 2005 beta1 fails with pthreads benchmark tests
- Prev by Date: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Next by Date: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Previous by thread: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Next by thread: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Index(es):
Relevant Pages
|