• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

C Source code Compile Warnings

Hello I am getting 5 different type of Warnings: when I build my C source module
( I am new in C source code)

Any remedy / suggestions or fixes will be greatly helpfull

Thanks
Shaw



They are followings:

1. /export/home/n9911742/Delta_Files/temp/vrtb02a2.c", line 117: warning: no explicit type given
2. /export/home/n9911742/Delta_Files/temp/vrtb02a2.c, line 2093: warning: implicit function declaration: UTL_C
SDateToSqlDate
3. /opt/vii/scm2src/prd/source/inc/virtuoso.h", line 2108: warning: macro redefined: INHERIT_PARENT
4. ld: warning: symbol `OP_Error_Return' has differing sizes:
        (file /opt/vii/scm2/prd-holdexe/lib/libvicss.so value=0x2c; file /opt/vii/scm2/prd-holdexe/lib/libvic
sd.so value=0x20);
5. /export/home/n9911742/Delta_Files/temp/vpay22s.c, line 753: warning: improper pointer/integer combination: arg #2
0
dmshawkat
Asked:
dmshawkat
2 Solutions
 
_iskywalker_Commented:
without any code is quite hardly tio analyse
0
 
dmshawkatAuthor Commented:
Following is the exerpt of the code, though I just want to get an idea, generally
what are the probable cause of these type warnings :)

/* SQLLIB Prototypes */

117 : extern sqlcxt (/*_ void **, unsigned int *,
                   struct sqlexd *, struct sqlcxp * _*/);

2062: sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);


0
 
i_maheshCommented:
1. In C it is allowed to define a function withought a return type, in this case the compiler will assume a default int return type. When the return type is not mentioned the new C compilers will issue a warning and internally treat the return type as int. It is advisable to explecitly mention the return type of all the functions.

  for eg in the code provided by you
extern sqlcxt (/*_ void **, unsigned int *,
                   struct sqlexd *, struct sqlcxp * _*/);

can be rewritten as
extern int sqlcxt (/*_ void **, unsigned int *,
                   struct sqlexd *, struct sqlcxp * _*/);

or whatver datatype is applicable.


2. No idea about this

3. This warning is issued when there is redefination of the macro. This situation may occur in the following scenarios.

    a. The macro with the same name is defined in different files in your source.
    b. The header in which the macro is defined has been included multiple times across the sources.

   in the first case it is advisable to define the macro only in only place and include the file wherever needed.

   In the second case one should enclose the header file in the #ifndef block to avoid multiple inclusions. for eg.

the starting and the end lines of the header file will look like

#ifndef __INCLUDED_THIS_HEADER__
#define __INCLUDED_THIS_HEADER__
.....
...
//Your definations go here
....
#endif //__INCLUDED_THIS_HEADER__

4. another case of redefination
5. Its a case where you are passing integer value where a pointer is expected as argument to the function or vice versa

Hope this helps you.
0
 
cupCommented:
2. You've used the function without defining a prototype so it is making up a prototype for you with the default type of int.

4. Is the same as 2.  You've called the routine in one place without defining a prototype so it assumes a return value of int.  You've declared it somewhere else with a return value of say char* or anything except int.  The return types don't match, hence the error
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now