Jump to content
Sign in to follow this  
skywalker

Compiler problem?

Recommended Posts

Hi

Does anybody know, what is wrong with this code:?

 

#define q0 -1

int a;

 

main()

{

   a = q0;  

}

 

If you change q0 to 1 then it works

 

 

Thx

Share this post


Link to post
Share on other sites

Thats odd, because if I'll try to compile this code:

 

#include <system.h>

main()
{
int a;

a=-1;
}

 

It will produce this outcome with C2C-plus compiler:

 

Compiling...

C:\PROGRA~1\SOURCE~1\c2c.exe -PPIC16F877 -SRC -ols -md -O2 -Ip16F877.inc -oneg.asm  neg.c

C2C-plus 5.3e C-compiler  Copyright(C) 1998-99,2000-2004 by Pavel Baranov
http://www.picant.com/c2c/c.html
[email=support@picant.com]support@picant.com[/email]
(Extended version)

Licensed to: Antti Toivanen


neg.c
neg.c(7): Error: General error

Finished.
Done

Failed

 

And with C2C++ compiler it goes like this:

 

Compiling...

C:\PROGRA~1\SOURCE~1\c2cpp.exe -PPIC16F877 -SRC -ols -md -O2 -W1 -Ip16F877.inc -oneg.asm  neg.c

C2C++ 5.3e C/C++ compiler  Copyright(C) 1998-1999,2000-2004 by Pavel Baranov
[email=support@picant.com]support@picant.com[/email]
(Extended version)

Licensed to: Antti Toivanen


neg.c
neg.c(7): General error
neg.c(7): General error

Finished.
Done

Failed

 

 

Perhaps you don't have same compiler as I do?

Share this post


Link to post
Share on other sites

I will concur with Stringer,  I tried same program

 

Compiling...

 

C:\PROGRA~1\SOURCE~1\c2c.exe -PPIC16F84 -SRC -ols -md -O2 -Ip16F84.inc -oneg.asm  neg.c

 

C2C-plus 5.3e C-compiler  Copyright© 1998-99,2000-2004 by Pavel Baranov

http://www.picant.com/c2c/c.html

support@picant.com

(Extended version)

 

Licensed to: Timothy Hosey

 

 

neg.c

neg.c(8): Error: General error

 

Finished.

Done

 

Failed

Share this post


Link to post
Share on other sites
Guest Pavel

Neither C2C-plus nor C2C++ compilers support signed data types. (This means that negative values can not be used in expressions)

 

Regards,

Pavel

 

PS: The new compiler that is under development will do signed math.

Share this post


Link to post
Share on other sites
Guest Kolitham

When will the new compiler going to release?

Will it have memory space reservation directives?

 

Thanks & Regards

 

Kolitha.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...