fixing warning C4244: ‘argument’ : conversion from ‘time_t’ to ‘unsigned int’, possible loss of data

Filed in CPlusPlus(CPP,c++) Programming Language Errors 0 comments

I had the code bellow returing this error
warning C4244: ‘argument’ : conversion from ‘time_t’ to ‘unsigned int’, possible loss of data

class quiz {
    public:
        int a,b;
public:
    int  Crandom(){
            srand(time(0));
            return rand() % 6 + 1;
        }
};
int main(){
    cout<<&quiz::Crandom;
    getch();
    return 0;
}

Resolution

The resolution is just to replace This code
srand(time(0));
with
srand((unsigned int)time(0));

Related posts:

  1. debugging this issue with php Fatal error: Allowed memory size of 553648128 bytes exhausted (tried to allocate 261900 bytes) in
  2. fixing Starting httpd: Syntax error on line 35 of /usr/local/directadmin/data/users/mainr/httpd.conf: Invalid command ‘php_admin_flag’, perhaps misspelled or defined by a module not included in the server configuration
Posted by voshka   @   22 June 2011 0 comments

Share This Post

RSS Digg Twitter StumbleUpon Delicious Technorati

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Previous Post
«
Next Post
»
CrossBlock designed by DeltaManual.Com  |  In conjunction with Web Hosting   |   Web Hosting   |   Reverse phone