[NTLUG:Discuss] OT: compile warnings

Kenneth Loafman kenneth at loafman.com
Tue Feb 5 14:46:04 CST 2008


Fred James wrote:
> Fred James wrote:
> 
>> All
>> This is a listing of the compile warnings from a C program that was 
>> compiling without error/warning ... the difference?
>> Was compiling on a 32 bit IRIX 6.4
>> Now compiling on a 64 bit IRIX 6.5.30
>>
>> The program is written as an external procedure to an Oracle database 
>> and it does build (create the library, package, and package body), and 
>> test, without error, but I am still concerned with the warnings in 
>> case of future issues.
>>
>> More detail upon request - Thank you in advance for any help you may 
>> be able to offer
>> Regards
>> Fred James
>>
> Oops - this stuff (originally sent as a "Forward") was chopped off - I 
> should have known better ...
> 
> remotejobmaker.sh[4]: libremotejob.so::  not found
> cc-1189 cc: WARNING File = remotejob.c, Line = 74
>   The indicated character escape sequence is unrecognized.
> 
>   	sprintf(command_str,"%s %s %s %d_%s_%s\.txt \"%s:%s:%d:%s:%s:%s:%s:%s:%s\"", SCRIPT_NAME, opt_mode, site_location, job_num, sub_job_string, action, action, site_name, job_num, volume_name, client_code, sub_job_string, subclient_code, job_desc, sub_job_desc);
>   	                                      ^
> 
> cc-1189 cc: WARNING File = remotejob.c, Line = 123
>   The indicated character escape sequence is unrecognized.
> 
>   	sprintf(command_str,"%s %s %s %d_%s_%s_job_info\.txt \"%d:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\"", SCRIPT_NAME, opt_mode, site_name, job_num, sub_job_string, action, job_num, date_time, customer, cust_client, team, salesteam_leader, date_due, csr, job_desc, subjob_desc, subjob_keyword_1);
>   	                                               ^

Just remove the '\' before the '.'.  The compiler is saying that '\.' is
not an escape sequence like '\n', '\e'.  Normally compiles ignore such
escapes and just give you a '.'.  This one does not.

> cc-1552 cc: WARNING File = remotejob.c, Line = 152
>   The variable "sign" is set but never used.
> 
>   	int i, x, sign;
>   	          ^

'sign' has been assigned, but not used for anything.  Since its an
automatic variable, this is just a waste of code.  Remove the def and
the assignment to save a bit of code.

> cc-3968 cc: WARNING File = remotejob.c, Line = 172
>   implicit conversion of a 64-bit integral type to a smaller integral type
>           (potential portability problem)
> 
>   	for (i = 0, j = strlen(s)-1; i < j; i++, j--) {

strlen() returns a 64-bit int.  'i' or 'j' must be normal ints.

Just because its a 64-bit compiler, 'int' is not necessarily a 64-bit
value unless your target is a 64-bit system.  C subscripts are int's, so
a true 64-bit compiler has int's as 64-bits to make use of all available
memory space.  [disclaimer - the standards may differ from what I said]

...Ken



More information about the Discuss mailing list