?
Solved

C Source code Compile Warnings

Posted on 2006-07-05
6
Medium Priority
?
629 Views
Last Modified: 2012-08-14
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
Comment
Question by:dmshawkat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Expert Comment

by:_iskywalker_
ID: 17046310
without any code is quite hardly tio analyse
0
 

Author Comment

by:dmshawkat
ID: 17046491
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
 
LVL 1

Accepted Solution

by:
i_mahesh earned 252 total points
ID: 17047411
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
 
LVL 11

Assisted Solution

by:cup
cup earned 248 total points
ID: 17049496
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

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 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