473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Compiler Problem

Following is an abstract of my code
Compiler is giving me an error at funciton call func1 as argument of
type void * is not compatible with parameter of type VP

typedef void * VP;

struct name
{
int i;
};

void func1(VP* v)
{
}
void main()
{
struct name n1,*n2;
n2=&n1;
func1((void *)&n2); /////////////////
}

Feb 19 '07 #1
5 1557
hyderabadblues wrote:
Following is an abstract of my code
Compiler is giving me an error at funciton call func1 as argument of
type void * is not compatible with parameter of type VP

typedef void * VP;

struct name
{
int i;
};

void func1(VP* v)
{
}
`func1` wants a `VP*`. But `VP` is `void*`. So `func1` wants
a `void**` - a pointer to pointer-to-void.
void main()
`int` main. int. INT. `main` returns `int`. Not `void`. `int`.
{
struct name n1,*n2;
n2=&n1;
func1((void *)&n2); /////////////////
`func1` wants a `void**`, but you've given it a `void*`. The
compiler says, quite rightly, that this is wrong.
}
Since `func1` doesn't do anything, I don't know why you wanted
to pass it a `void**`. If you explain what you're trying to do,
perhaps we can offer constructive advice.

--
Chris "electric hedgehog" Dollin
The "good old days" used to be much better.

Feb 19 '07 #2
hyderabadblues wrote:
Following is an abstract of my code
Compiler is giving me an error at funciton call func1 as argument of
type void * is not compatible with parameter of type VP

typedef void * VP;

struct name
{
int i;
};

void func1(VP* v)
{
}
void main()
{
struct name n1,*n2;
n2=&n1;
func1((void *)&n2); /////////////////
}
Are you sure you are compiling this (wretched, horrible)
code with a C compiler and not with a C++ compiler? The two
languages differ in many ways, among them in their treatment
of `void*'.

--
Eric Sosman
es*****@acm-dot-org.invalid

Feb 19 '07 #3
On Feb 19, 10:52 am, "hyderabadblues" <sirishku...@gmail.comwrote:
Following is an abstract of my code
Compiler is giving me an error at funciton call func1 as argument of
type void * is not compatible with parameter of type VP

typedef void * VP;
Here, you typedef the name VP to a pointer to void
struct name
{
int i;
};

void func1(VP* v)
Here, you say that func1 takes as it's argument a pointer to VP.
Since VP is typedefed as a pointer to void, this means that you've
made func1 require an argument of pointer to pointer to void.
{
}

void main()
Unless you are working in a freestanding implementation, main is
required to return an integer. This should be
int main(void)
{
struct name n1,*n2;
n2=&n1;
func1((void *)&n2); /////////////////
Here, you pass func1 an argument that is a pointer to void. Remember,
you defined func1() to require a pointer to pointer to void, so this
call to func1() has an argument mismatch with the definition.

Also, since main() returns an integer, good programming practice (and
certain backlevels of the C standard) requires that you return an
integer before falling off the end of main(). So
return 0;
}
HTH
--
Lew

Feb 19 '07 #4
On Feb 19, 5:01 pm, Eric Sosman <esos...@acm-dot-org.invalidwrote:
hyderabadblues wrote:
Following is an abstract of my code
Compiler is giving me an error at funciton call func1 as argument of
type void * is not compatible with parameter of type VP
typedef void * VP;
struct name
{
int i;
};
void func1(VP* v)
{
}
void main()
{
struct name n1,*n2;
n2=&n1;
func1((void *)&n2); /////////////////
}

Are you sure you are compiling this (wretched, horrible)
code with a C compiler and not with a C++ compiler? The two
languages differ in many ways, among them in their treatment
of `void*'.

--
Eric Sosman
esos...@acm-dot-org.invalid

I am using ARM compiler . This is just a small briefing of my code

Feb 19 '07 #5
hyderabadblues wrote, On 19/02/07 16:10:
On Feb 19, 5:01 pm, Eric Sosman <esos...@acm-dot-org.invalidwrote:
>hyderabadblues wrote:
>>Following is an abstract of my code
Compiler is giving me an error at funciton call func1 as argument of
type void * is not compatible with parameter of type VP
typedef void * VP;
<snip>
>> void func1(VP* v)
{
}
<snip>
>> func1((void *)&n2); /////////////////
}
Are you sure you are compiling this (wretched, horrible)
code with a C compiler and not with a C++ compiler? The two
languages differ in many ways, among them in their treatment
of `void*'.

--
Eric Sosman
esos...@acm-dot-org.invalid
Please do not quote peoples signatures (the bit after the "-- ") unless
you are commenting on them.
I am using ARM compiler . This is just a small briefing of my code
That is not an answer to Eric's question. I'm sure that if you looked
hard enough you could find an Ada compiler for the ARM processor and
that would not compile C code properly just as a C++ compiler would not
compile all C code properly (and not as C code at all).

Now, are you using a C compiler for the ARM (or a compiler that supports
multiple languages in its C mode) as oppose to, just for instance, a C++
compiler. If you do not know the answer to this question you need to
read the documentation for the compiler and/or ask on a group where the
"ARM compiler" is topical so you can find out.
--
Flash Gordon
Feb 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: jon morgan | last post by:
OK, I'm going to be brave. There is a bug in VS.Net 1.1 that causes random compiler errors. I have raised this issue in posts at least three time in the past couple of months without attracting...
16
by: pj | last post by:
(Was originally, probably wrongly, posted to the vc subgroup.) (This doesn't appear to be a c# problem, but a problem with a bug in the Visual Studio c# compiler, but, any help will be welcome...)...
3
by: Mark Rockman | last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error...
8
by: jon morgan | last post by:
OK, I'm going to be brave. There is a bug in VS.Net 1.1 that causes random compiler errors. I have raised this issue in posts at least three time in the past couple of months without attracting...
41
by: Miroslaw Makowiecki | last post by:
Where can I download Comeau compiler as a trial version? Thanks in advice.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.