Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualMathimetric

Posted 09 January 2014 - 11:30 AM

EDITED DUE TOO THE COMMENT BELOW FROM MODERATION:

ABOUT THE PROGRAM' MEMORY LEAK; (FIX)

 

did you try checking the string[Lvalue] characters by using...

 

<ctype.h>

 

int _RTLENTRY _EXPFUNC isalnum (int __c);
int _RTLENTRY _EXPFUNC isalpha (int __c);
int _RTLENTRY _EXPFUNC iscntrl (int __c);
int _RTLENTRY _EXPFUNC isdigit (int __c);
int _RTLENTRY _EXPFUNC isgraph (int __c);
int _RTLENTRY _EXPFUNC islower (int __c);
int _RTLENTRY _EXPFUNC isprint (int __c);
int _RTLENTRY _EXPFUNC ispunct (int __c);
int _RTLENTRY _EXPFUNC isspace (int __c);
int _RTLENTRY _EXPFUNC isupper (int __c);
int _RTLENTRY _EXPFUNC isxdigit(int __c);
int _RTLENTRY _EXPFUNC isascii (int __c);

 

you could use these to maybe determine if you have a number or not.

you could also try being more specific to handling the errors by using a pointer return value

 

such as

typedef <type> number_;

 

//(EDIT)/////////////////////////////////////////////////////////////////

// pointer rtn is givin a static address only 1 time so there is no memory leaks'

//

number_ * stringtonum(string_type  *)

{

static number_ * rtn;                               

if( rtn == NULL){ rtn = new number_[2]; }

 

//where rtn[0] == error handle , rtn[1] == converted num

//.........do conversion block ..............///

 

return rtn;  //return address to variable rtn

}

 

 

example impliment:

 

#define out<<        ....

#define error_       ....

 

if(   (*(stringtonum(data)+0)) ) out<<error_; //is there an error in rtn?

 else

assign = (*(stringtonum(data)+1));

 

 

 

///edited to ocommidate  the BELOW COMMENT

///there is no leak if the return type is givin a static address -> to point too


#6Mathimetric

Posted 09 January 2014 - 11:27 AM

EDITED DUE TOO THE COMMENT BELOW FROM MODERATION:

ABOUT THE PROGRAM' MEMORY LEAK; (FIX)

 

did you try checking the string[Lvalue] characters by using...

 

<ctype.h>

 

int _RTLENTRY _EXPFUNC isalnum (int __c);
int _RTLENTRY _EXPFUNC isalpha (int __c);
int _RTLENTRY _EXPFUNC iscntrl (int __c);
int _RTLENTRY _EXPFUNC isdigit (int __c);
int _RTLENTRY _EXPFUNC isgraph (int __c);
int _RTLENTRY _EXPFUNC islower (int __c);
int _RTLENTRY _EXPFUNC isprint (int __c);
int _RTLENTRY _EXPFUNC ispunct (int __c);
int _RTLENTRY _EXPFUNC isspace (int __c);
int _RTLENTRY _EXPFUNC isupper (int __c);
int _RTLENTRY _EXPFUNC isxdigit(int __c);
int _RTLENTRY _EXPFUNC isascii (int __c);

 

you could use these to maybe determine if you have a number or not.

you could also try being more specific to handling the errors by using a pointer return value

 

such as

typedef <type> number_;

 

//(EDIT)/////////////////////////////////////////////////////////////////

// pointer rtn is givin a static address only 1 time so there is no memory leaks'

//

number_ * stringtonum(string_type  *)

{

static number_ * rtn;                               

if( rtn == NULL){ rtn = new number_[2]; }

 

//where rtn[0] == error handle , rtn[1] == converted num

//.........do conversion block ..............///

 

return rtn;  //return address to variable rtn

}

 

 

example impliment:

 

#define out<<        ....

#define error_       ....

 

if(   (*(stringtonum(data)+0)) ) out<<error_; //is there an error in rtn?

 else

assign = (*(stringtonum(data)+1));


#5Mathimetric

Posted 15 March 2013 - 12:51 PM

did you try checking the string[Lvalue] characters by using...

 

<ctype.h>

 

int _RTLENTRY _EXPFUNC isalnum (int __c);
int _RTLENTRY _EXPFUNC isalpha (int __c);
int _RTLENTRY _EXPFUNC iscntrl (int __c);
int _RTLENTRY _EXPFUNC isdigit (int __c);
int _RTLENTRY _EXPFUNC isgraph (int __c);
int _RTLENTRY _EXPFUNC islower (int __c);
int _RTLENTRY _EXPFUNC isprint (int __c);
int _RTLENTRY _EXPFUNC ispunct (int __c);
int _RTLENTRY _EXPFUNC isspace (int __c);
int _RTLENTRY _EXPFUNC isupper (int __c);
int _RTLENTRY _EXPFUNC isxdigit(int __c);
int _RTLENTRY _EXPFUNC isascii (int __c);

 

you could use these to maybe determine if you have a number or not.

you could also try being more specific to handling the errors by using a pointer return value

 

such as

typedef <type> number_;

 

number_ * stringtonum(string_type  *)

{

number_ * rtn; 

rtn = new number_[2];   //where rtn[0] == error handle , rtn[1] == converted num

//.........do conversion block ..............///

return rtn;  //return address to variable rtn

}

 

 

example impliment:

 

#define out<<        ....

#define error_       ....

 

if(   (*(stringtonum(data)+0)) ) out<<error_; //is there an error in rtn?

 else

assign = (*(stringtonum(data)+1));


#4Mathimetric

Posted 15 March 2013 - 12:48 PM

did you try checking the string[Lvalue] characters by using...

 

<ctype.h>

 

int _RTLENTRY _EXPFUNC isalnum (int __c);
int _RTLENTRY _EXPFUNC isalpha (int __c);
int _RTLENTRY _EXPFUNC iscntrl (int __c);
int _RTLENTRY _EXPFUNC isdigit (int __c);
int _RTLENTRY _EXPFUNC isgraph (int __c);
int _RTLENTRY _EXPFUNC islower (int __c);
int _RTLENTRY _EXPFUNC isprint (int __c);
int _RTLENTRY _EXPFUNC ispunct (int __c);
int _RTLENTRY _EXPFUNC isspace (int __c);
int _RTLENTRY _EXPFUNC isupper (int __c);
int _RTLENTRY _EXPFUNC isxdigit(int __c);
int _RTLENTRY _EXPFUNC isascii (int __c);

 

you could use these to maybe determine if you have a number or not.

you could also try being more specific to handling the errors by using a pointer return value

 

such as

typedef <type> number_;

 

number_ * stringtonum(string_type  *)

{

number_ * rtn; 

rtn = new number_[2];   //where rtn[0] == error handle , rtn[1] == converted num

//.........do conversion block ..............///

return rtn;  //return address to variable rtn

}

 

 

example impliment

 

if(   (*(stringtonum(data)+0)) ) //is there an error in rtn?

 else

assign = (*(stringtonum(data)+1));


#3Mathimetric

Posted 15 March 2013 - 12:39 PM

did you try checking the string[Lvalue] characters by using...

 

<ctype.h>

 

int _RTLENTRY _EXPFUNC isalnum (int __c);
int _RTLENTRY _EXPFUNC isalpha (int __c);
int _RTLENTRY _EXPFUNC iscntrl (int __c);
int _RTLENTRY _EXPFUNC isdigit (int __c);
int _RTLENTRY _EXPFUNC isgraph (int __c);
int _RTLENTRY _EXPFUNC islower (int __c);
int _RTLENTRY _EXPFUNC isprint (int __c);
int _RTLENTRY _EXPFUNC ispunct (int __c);
int _RTLENTRY _EXPFUNC isspace (int __c);
int _RTLENTRY _EXPFUNC isupper (int __c);
int _RTLENTRY _EXPFUNC isxdigit(int __c);
int _RTLENTRY _EXPFUNC isascii (int __c);

 

you could use these to maybe determine if you have a number or not.

you could also try being more specific to handling the errors by using a pointer return value

 

such as

typedef <type> number_

 

number_ * stringtonum(string_type  *)

{

number_ * rtn; 

rtn = new datatype[2];   //where rtn[0] == error handle , rtn[1] == converted num

//.........do conversion block ..............///

return rtn;  //return address to variable rtn

}

 

 

example impliment

 

if(   (*(stringtonum(data)+0)) ) //is there an error in rtn?

 else

assign = (*(stringtonum(data)+1));


#2Mathimetric

Posted 15 March 2013 - 12:28 PM

did you try checking the string[Lvalue] characters by using...

 

<ctype.h>

 

int _RTLENTRY _EXPFUNC isalnum (int __c);
int _RTLENTRY _EXPFUNC isalpha (int __c);
int _RTLENTRY _EXPFUNC iscntrl (int __c);
int _RTLENTRY _EXPFUNC isdigit (int __c);
int _RTLENTRY _EXPFUNC isgraph (int __c);
int _RTLENTRY _EXPFUNC islower (int __c);
int _RTLENTRY _EXPFUNC isprint (int __c);
int _RTLENTRY _EXPFUNC ispunct (int __c);
int _RTLENTRY _EXPFUNC isspace (int __c);
int _RTLENTRY _EXPFUNC isupper (int __c);
int _RTLENTRY _EXPFUNC isxdigit(int __c);
int _RTLENTRY _EXPFUNC isascii (int __c);

 

you could use these to maybe determine if you have a number or not.


PARTNERS