C question

M

Martin Ambuhl

Ficus said:
When writing C code, which editor is better, vi or emacs, and why?

This is the kind of post designed to start a flamefest.

The editor you are more comfortable with is better.
It is better because it is the one you are more comfortable with.
Many people suffer from "first-editor syndrome" (and "first-language
syndrome" and "first-OS syndrome"). Whatever tool they learned with
always has some feature that the new tool lacks.

My first editor apart from coding sheets was TECO. It had a number of
features missing from almost all modern editors. I recommend it. My
first language was ALGOL-60. Very few modern languages have
call-by-name. I recommend it.
 
I

Ian Collins

Martin said:
This is the kind of post designed to start a flamefest.

The editor you are more comfortable with is better.
It is better because it is the one you are more comfortable with.
Many people suffer from "first-editor syndrome" (and "first-language
syndrome" and "first-OS syndrome"). Whatever tool they learned with
always has some feature that the new tool lacks.

My first editor apart from coding sheets was TECO.

Ah, that brings back memories!
It had a number of
features missing from almost all modern editors. I recommend it. My
first language was ALGOL-60. Very few modern languages have
call-by-name. I recommend it.

PHP (along with other "scripting" languages) does. With a little help
from the environment and an extra level of indirection, C can as well.
 
S

Spiros Bousbouras

0 out of 10

Oh come on, you have to give the guy at least
1 point for originality. The usual flamebait
around here is some sort of C vs C++ comparison,
at least he tried something new.
 
C

Chris Dollin

Ian said:
Martin Ambuhl wrote:

PHP (along with other "scripting" languages) does. With a little help
from the environment and an extra level of indirection, C can as well.

Erm ... no? I think you're thinking that call-by-name is either
call-by-reference, or call-by-string-and-eval.

Suppose in a call-by-name language we write

int jensen( int index, int expr )
{
int result = 0;
for (index = 0; index < 10; index += 1) result += expr;
return result;
}

int main() { int i; print jensen( i, i * i ); }

This will print 45. Bearing in mind that `i * i` stands for any
expression that involves `i`, including ones that access arbitrary
values from the same environment as `i`, I don't think that "a little
help from the environment and an extra level of indirection" are
enough.
 
G

Guest

Erm ... no? I think you're thinking that call-by-name is either
call-by-reference, or call-by-string-and-eval.

Suppose in a call-by-name language we write

   int jensen( int index, int expr )
        {
        int result = 0;
        for (index = 0; index < 10; index += 1) result += expr;
        return result;
        }

   int main() { int i; print jensen( i, i * i ); }

This will print 45. Bearing in mind that `i * i` stands for any
expression that involves `i`, including ones that access arbitrary
values from the same environment as `i`, I don't think that "a little
help from the environment and an extra level of indirection" are
enough.

ah, Jenson's device! they don't write 'em like that anymore!
 
G

Guest

Erm ... no? I think you're thinking that call-by-name is either
call-by-reference, or call-by-string-and-eval.

Suppose in a call-by-name language we write

   int jensen( int index, int expr )
        {
        int result = 0;
        for (index = 0; index < 10; index += 1) result += expr;
        return result;
        }

   int main() { int i; print jensen( i, i * i ); }

This will print 45.

why? I made it 285...
Bearing in mind that `i * i` stands for any
expression that involves `i`, including ones that access arbitrary
values from the same environment as `i`, I don't think that "a little
help from the environment and an extra level of indirection" are
enough.

you can almost emulate it in another language

(define (jensen i expr)
(define result 0)

(do ((i 0 (+ i 1)))
((= i 10) #t)
(begin
(set! result (+ result (expr i)))
;(display (expr i))(newline)
))
result)

(define (main)
(display (jensen 'i (lambda (i) (* i i))))
(newline))

(main)

--
Nick Keighley
"ALGOL 60 was a language so far ahead of its time that it
was not only an improvement on its predecessors but also
on nearly all its successors".
--C.A.R. Hoare
 
N

Nelu

On Thu, 12 Feb 2009 09:19:13 -0600, Anthony Fremont wrote:

There's nothing original about a vi vs. emacs troll. Everyone knows
that nano and ed are the Un*x editors to use.

You mean sed + ed... nano/pico is for lazy people.
 
N

Nate Eldredge


Amusingly, it appears there is an editor called MU. Sadly, it's not a
text editor; it looks like it's for editing MIDI instruments or
something.

I see a niche...
 
T

Tim Rentsch

Martin Ambuhl said:
This is the kind of post designed to start a flamefest.

The editor you are more comfortable with is better.
It is better because it is the one you are more comfortable with.
Many people suffer from "first-editor syndrome" (and "first-language
syndrome" and "first-OS syndrome"). Whatever tool they learned with
always has some feature that the new tool lacks.

My first editor apart from coding sheets was TECO. It had a number of
features missing from almost all modern editors. I recommend it.

I assume you know that emacs (Editor MACroS) was written originally as
a set of TECO macros.
 
R

Richard Bos

Vi vs. eMacs is like choosing between disemboweling and the pyre. Nano
vs. ed is like hanging, drawing, and _then_ disemboweling, or hanging,
drawing, and burning.
Use a _real_ Cthulhudamned editor, already. If you want torture, turn
your computer off and find your nearest S/M mistress.
Sometimes full screen is convenient, like taking something that was posted
here and reformatting it into something legible.

It takes more than a mere editor to do that.
I must confess that I use Ultraedit under windos, I like the syntax
hilighting.

*Nunc dimitte me...*

Richard
 
F

Ficus Elastica

Richard said:
Ficus Elastica said:


Whichever you like best, because it's the one you like best.

But I have never used neither. But on the computer I have to use that's
all that's available and worse, there's multiple incarnations of both:

vi: vi, nvi, vim, elvis
emacs: xemacs, GNU/emacs, lucid emacs, joe(?)

This is so confusing!!

Which one is best for C code?
 
S

Spiros Bousbouras

But I have never used neither. But on the computer I have to use that's
all that's available and worse, there's multiple incarnations of both:

vi: vi, nvi, vim, elvis
emacs: xemacs, GNU/emacs, lucid emacs, joe(?)

This is so confusing!!

Which one is best for C code?

Both are fine. If you have such a hard time deciding
just flip a coin.
 
S

Spiros Bousbouras

My guess is that there are two editors and the rest are shell scripts that
invoke the two with different arguments. Check your man pages.

xemacs is different from GNU/emacs. See
http://www.jwz.org/doc/lemacs.html

vim, nvi, elvis are also mutually distinct. vi may
or may not be the same executable as vim, it's
system dependent. If they are the same then
vim examines how it was called and if it was
called as vi it puts itself into compatibility mode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top