?
Solved

Assertion failure in isctype.c

Posted on 2005-02-28
7
Medium Priority
?
1,977 Views
Last Modified: 2008-02-20
Hi there,

I'm currently using VC 7.1 to develop a Win32 application, everything is working fine with the exception that I am recieving an assertion failure at a point in my program.  If I debug, I get taken to the following function within "isctype.c"

#if !defined (_MT) || defined (_DEBUG)
int __cdecl _chvalidator(
        int c,
        int mask
        )
{
        _ASSERTE((unsigned)(c + 1) <= 256);
        return ( _pctype[c] & mask);
}

The comment above the function tells me that it is checking to make sure that C code that includes ctype.h is not compiled using "/D_DEBUG /ML".  Is there a simple explanation for this?  And if possible what is the work around?

I'm presuming that I might have a problem with my projects configuration, if anyone could help me solve this I would be most appreciative!

Nick.
0
Comment
Question by:tcarmich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:tcarmich
ID: 13418535
May I just add that I've managed to solve this issue by changing my configuration to "Release".  So this is presumably because I was compiling using some debugging constant??  I am using precompile headers if that makes any difference.

Nick.
0
 
LVL 8

Expert Comment

by:novitiate
ID: 13418583
_ASSERTE((unsigned)(c + 1) <= 256); this is checking for signed characters.

ctype.h doesn't work with signed character types, check your call stack, some where you are passing signed character. Also confirm you haven't enabled or working with Unicode.

_novi_
0
 
LVL 8

Expert Comment

by:novitiate
ID: 13418595
Its obvious that you don't see that assertion in Release, due to i#if defined(_DEBUG)
but this does not necessarily mean, the code is error free. You still need to fix the bug.

_novi_
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tcarmich
ID: 13418615
So is this error simply due to an _MT or _DEBUG constant being defined in an object library maybe?  I'm using various Microsoft SDK's so maybe I have included the wrong library somewhere along the lines...
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 13418659
Project settings are OK, there is some problem in your problem. My guess is that some value which must represent character and to in 0-255 interval, is out of range. You need to show stack including your own code line which caused this situation, in this case we can be more specific.
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 1500 total points
ID: 13418670
Project settings are OK, there is some problem in your problem :-(
I mean - in your code.
Debug configuration always contains additional checks and assertions. You can ignore them, but usually this points to actual error in the code.
0
 

Author Comment

by:tcarmich
ID: 13418788
Right okay, I'm sure this will become apparent soon enough.  Thanks for your help!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question