RDS
Posts: 736
Joined: Tue Oct 06, 2015 8:17 am
Location: Lancashire, UK

Which Editor for C Programs

Tue Apr 05, 2016 7:56 pm

I am familiar with the IDLE screens for Programming in Python 2 or 3 but I would like to have a play around with the C Language.

I apologise for such a very basic question but which Editor is used for the C Language on the Pi.

fruit-uk
Posts: 609
Joined: Wed Aug 06, 2014 4:19 pm
Location: Suffolk, UK

Re: Which Editor for C Programs

Tue Apr 05, 2016 7:59 pm

Any text editor will do but you may find it easier with one that has highlighting schemas

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Which Editor for C Programs

Tue Apr 05, 2016 8:07 pm

RDS wrote:I apologize for such a very basic question but which Editor is used for the C Language on the Pi.
If you are genuinely serious about the question -- big if -- then you will learn vi (or vim). The reason for this answer is that its traditional (not just the PI) and it works across the network on any normal terminal.

You should learn vi because its a cultural piece of unix and a traditional piece of unix programming, um, C.

Having said that, folks around here (and in lots of publications too) use nano. It also works across the network, but not consistently in all terminals.

Most vi and nano based editors today have highlighting available and closures (like for braces and parens). But, like with most other things coke and pepsi, what do you like? Try them, learn them, and then choose one.

My choice is vi. Let me know what you choose.
marcus
:ugeek:

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: Which Editor for C Programs

Tue Apr 05, 2016 8:12 pm

onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.

Code: Select all

sudo apt-get install geany
parameters for compile and build:
make -> commands for make (compile and build)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

RDS
Posts: 736
Joined: Tue Oct 06, 2015 8:17 am
Location: Lancashire, UK

Re: Which Editor for C Programs

Tue Apr 05, 2016 9:34 pm

fruit-uk wrote:Any text editor will do but you may find it easier with one that has highlighting schemas
Thanks but do you have any suggestions.
Also, having edited the program, how do you run it.

On IDLE with Python, I just press F5.

RDS
Posts: 736
Joined: Tue Oct 06, 2015 8:17 am
Location: Lancashire, UK

Re: Which Editor for C Programs

Tue Apr 05, 2016 9:36 pm

davenull wrote:onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.
I think this may be the answer I am looking for.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: Which Editor for C Programs

Wed Apr 06, 2016 7:31 am

yes, having read this:
when correctly configured in preferences, you may
compile (F8)
build (F9)
run (F5)
your program, out of the IDE

I wrote a short "Quick Guide" about this (because to my experience as a newbie it's almost impossible to find something out of the blue to make C/C++ things run on the Pi),
but although it's in German you perhaps might find it helpful!

http://www.mindstormsforum.de/viewtopic ... 769#p67771

edit,
In the TOP is an overview about the most important sub-topics:
http://www.mindstormsforum.de/viewtopic ... 769#p67768

share and enjoy!
Last edited by davenull on Wed Apr 06, 2016 7:52 am, edited 2 times in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

RDS
Posts: 736
Joined: Tue Oct 06, 2015 8:17 am
Location: Lancashire, UK

Re: Which Editor for C Programs

Wed Apr 06, 2016 7:42 am

@davenull
That is very helpful and as soon as I loaded the page, my computer translated it for me.
Danke.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: Which Editor for C Programs

Wed Apr 06, 2016 7:50 am

Bitteschön, you're welcome! 8-)

(Hope Google Translate will work comprehensible though ;) )
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

jahboater
Posts: 4837
Joined: Wed Feb 04, 2015 6:38 pm

Re: Which Editor for C Programs

Wed Apr 06, 2016 11:43 am

If you are running a GUI/X the "gedit" editor is great.
Full colour syntax display of course.
sudo apt-get install gedit.

User avatar
JRV
Posts: 270
Joined: Mon Apr 02, 2012 1:39 pm
Location: Minneapolis, MN

Re: Which Editor for C Programs

Wed Apr 06, 2016 12:55 pm

I used to use gedit but the new version of gedit that comes with jessie does not let you change the font, and in the font supplied all the characters are not the same width. I switched to geany and I love it.

User avatar
experix
Posts: 204
Joined: Mon Nov 10, 2014 7:39 pm
Location: Coquille OR
Contact: Website

Re: Which Editor for C Programs

Wed Apr 06, 2016 2:05 pm

I like nano, especially my personal version of it, but does anybody know how to avoid the annoying slow-down that it exhibits when displaying far down in a long file, with syntax highlighting turned on? I guess the problem is that every time it needs to re-write the screen, it starts at the top of the file in order to figure out whether the currently displayed location is inside a comment. Maybe something smarter could be done.

swampdog
Posts: 271
Joined: Fri Dec 04, 2015 11:22 am

Re: Which Editor for C Programs

Sat Apr 09, 2016 12:25 am

'nano'

I've used 'vi' and 'emacs' in my time. Nano (-w) beats them all.

User avatar
topguy
Posts: 5946
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Which Editor for C Programs

Mon Apr 11, 2016 2:05 pm

swampdog wrote:'nano'

I've used 'vi' and 'emacs' in my time. Nano (-w) beats them all.
Then you have actually never used vi or emacs, you have just looked at them. ;)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24139
Joined: Sat Jul 30, 2011 7:41 pm

Re: Which Editor for C Programs

Mon Apr 11, 2016 3:07 pm

Keep it sane people. Editor wars will not be accepted.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

jahboater
Posts: 4837
Joined: Wed Feb 04, 2015 6:38 pm

Re: Which Editor for C Programs

Mon Apr 11, 2016 5:38 pm

These editors are simply not comparable (apart from the basic fact that they are all text editors).

Nano is simple, usable directly, and great for beginners or people new to Linux.

Vi has an intense learning curve, is very powerful and fast when you know it. It is universally available. You can do far more work in far fewer key strokes in Vi (with its bi-modal paradigm) than you ever could with Nano.

Emacs is a complete development IDE all in one. If you can program in Lisp, it is supremely extensible.

All three are great editors!

User avatar
buja
Posts: 507
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: Which Editor for C Programs

Mon Apr 11, 2016 5:53 pm

jahboater wrote:...
All three are great editors!
No, no, no, it doesn't work that way!
You must choose one editor that you love and hate all others and curse their users. And you must defend your choice until death and most of all against better judgment, otherwise it's no fun at all :twisted:

jahboater
Posts: 4837
Joined: Wed Feb 04, 2015 6:38 pm

Re: Which Editor for C Programs

Mon Apr 11, 2016 6:01 pm

buja wrote:
jahboater wrote:...
All three are great editors!
No, no, no, it doesn't work that way!
You must choose one editor that you love and hate all others and curse their users. And you must defend your choice until death and most of all against better judgement, otherwise it's no fun at all :twisted:
Actually I don't use any of them, I use an editor I wrote myself.
But you are right of course!

User avatar
buja
Posts: 507
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: Which Editor for C Programs

Mon Apr 11, 2016 6:13 pm

jahboater wrote:Actually I don't use any of them, I use an editor I wrote myself.
...
Respect :!:

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: Which Editor for C Programs

Mon Apr 11, 2016 6:18 pm

vi? nano? emacs? homebrewed?
:lol:

the OP is supposed to have already chosen the ultimate answer to C, Raspi, and everything!
:mrgreen:
RDS wrote:
davenull wrote:onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.
I think this may be the answer I am looking for.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

jahboater
Posts: 4837
Joined: Wed Feb 04, 2015 6:38 pm

Re: Which Editor for C Programs

Mon Apr 11, 2016 6:43 pm

davenull wrote:vi? nano? emacs? homebrewed?
:lol:
As @buja pointed out, any topic entitled "Which is the best editor for ..." will immediately start an intense heated debate lasting forever (called an editor war). Its been true ever since the early days of usenet and probably before. This forum stands out for the decorum and patience shown by the participants!

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: Which Editor for C Programs

Mon Apr 11, 2016 6:45 pm

no way, no war, just funny :lol:
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

hippy
Posts: 6237
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Which Editor for C Programs

Mon Apr 11, 2016 6:55 pm

jahboater wrote:Actually I don't use any of them, I use an editor I wrote myself.
I favour that route, then one can make it exactly how one wants it, add things which others never thought of and might not even like. It does require having the skills to create it and the time to do it.

The big question of course; which editor did you use to code your own editor :D

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: Which Editor for C Programs

Mon Apr 11, 2016 7:05 pm

Actually - apart of funny, entertainment, or flame war purposes - this discussion actually won't lead to anything any more, because, as I already statet:
davenull wrote:
the OP is supposed to have already chosen the ultimate answer to C, Raspi, and everything!
RDS wrote:
davenull wrote:onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.
I think this may be the answer I am looking for.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

jahboater
Posts: 4837
Joined: Wed Feb 04, 2015 6:38 pm

Re: Which Editor for C Programs

Mon Apr 11, 2016 7:19 pm

hippy wrote:
jahboater wrote:Actually I don't use any of them, I use an editor I wrote myself.
I favour that route, then one can make it exactly how one wants it.
Exactly, and emacs is also popular for just that reason.
Once its basically working, you MUST use the editor itself, then you quickly find any bugs.
But in the first instance, the bootstrap, I'm not telling ... :-)

Return to “C/C++”