Solved

C Source code Compile Warnings

Posted on 2006-07-05
6
604 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
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 63 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 62 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now