Pages: [1] 2   Go Down
Author Topic: ANSI C  (Read 965 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 2
Posts: 158
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all

Can I program C code based on ANSI C on the ARDUINO IDE ?

Thanks
Elico
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13031
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


No.  It's a C++ compiler.  I believe several ANSI C things are not supported in C++.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13031
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Yes.  If you create a "tab" with a dot-C extension.
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 158
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Waht is a "tab" ?
Logged

New Hampshire
Offline Offline
God Member
*****
Karma: 17
Posts: 781
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


No.  It's a C++ compiler.  I believe several ANSI C things are not supported in C++.


Yes.  If you create a "tab" with a dot-C extension.

Don't you know the appropriate thing to do is to wipe out all evidence of your first post?  Or were you just waiting for somebody to quote you first, to add to the confusion?  If so, there you go. smiley-wink
Logged


Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13031
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't you know the appropriate thing to do is to wipe out all evidence of your first post?

Why would I do that?  The question was precise; the expected response would include similar precision.  Both responses are correct.  The "sketch tab" is not processed by an ANSI C compiler.

Quote
Or were you just waiting for somebody to quote you first, to add to the confusion?

What part of my response is confusing?  If elico truly wants ANSI C (which was his question) he will not get it from the "sketch tab".  If elico truly wants ANSI C from the ARDUINO IDE (which was his question) he can get it from a dot-C tab.

If, instead, elico was seeking a "good C or C++ compiler on the Arduino IDE" then he can state so.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13031
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


@jraskell: I apologize.  Now that I've climbed off my jackbox# I can see my posts are indeed confusing.

@elico: Do you really need an "ANSI C" compiler?


# Like a soapbox but instead of the person standing on the box rambling about politics the person is acting like a jack... Well, you get the idea.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 502
Posts: 19085
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

... based on ANSI C ...

Based on? But not actually C?
Logged


Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What parts of ANSI C are not incorporated into C++? I think his question was more along the lines of, can he tell the compiler to reject C++ features and act as a strict C compiler. I don't believe the Arduino environment can do that. So if that was the question, I think the answer is no.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 502
Posts: 19085
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure that was the question. But only OP knows that ...
Logged


Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13031
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What parts of ANSI C are not incorporated into C++?

Function declarations / definitions were a problem at my old job.

Legal ANSI but not C++...
Code:
noreturntype()
{
}

In ANSI, the declaration does not have to match the definition...
Code:
noreturntype();

noreturntype( int whateverdude )
{
}
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What parts of ANSI C are not incorporated into C++?

Function declarations / definitions were a problem at my old job.

Legal ANSI but not C++...
Code:
noreturntype()
{
}

In ANSI, the declaration does not have to match the definition...
Code:
noreturntype();

noreturntype( int whateverdude )
{
}

Hm, I would have to dig into the spec, and maybe this depends upon how on defines "ANSI C", but I don't think those examples are valid C or C+ code. Perhaps they were at one time, but I don't think that's legal syntax today.

Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13031
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Care to place a wager?   smiley-money   smiley-grin
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 502
Posts: 19085
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Waht is a "tab" ?

There is an icon on the top RH corner of the IDE screen. That makes a new "tab" in the project which you can name xxx.c, xxx.cpp, or xxx.h.
Logged


Offline Offline
Full Member
***
Karma: 2
Posts: 158
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks
I am asking this because I wonder if after getting used to  ARDUINO ide , will i be able to program
 in the AVR STUDIO withot much sweat ..

That is the point .

Elico
Logged

Pages: [1] 2   Go Up
Jump to: