?
Solved

Assertion failure in isctype.c

Posted on 2005-02-28
7
Medium Priority
?
1,996 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
  • 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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

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

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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

601 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