C editor
1
Name:
Anonymous
2012-09-12 14:20
I started reading K&R.
Until now, I've been using nano to code. However, I heard there are more efficient editors.
I wanted something that would tell me if there is a missing } ,for example, before I try to compile.
Another thing I seem to always do is to type things as following:
printf
printf()
printf("")
printf("\n")
printf("hello, world\n")
Basically, I go from the general to the specific. Is there any editor who automates this process?
2
Name:
Anonymous
2012-09-12 14:29
vim does that with plugins.
3
Name:
Anonymous
2012-09-12 14:32
reviewing with syntax highlighting should be good enough
4
Name:
Anonymous
2012-09-12 14:34
I know for a fact sublime text does that. Sublime text is really just emacs for niggers and windows users.
5
Name:
Anonymous
2012-09-12 14:35
yeah, it's called vim macros
6
Name:
Anonymous
2012-09-12 14:36
I wanted something that would tell me if there is a missing } ,for example, before I try to compile.
see clang_complete for vim
7
Name:
Anonymous
2012-09-12 14:38
Vim be it then.
Thank you
8
Name:
Anonymous
2012-09-12 15:23
9
Name:
Anonymous
2012-09-12 18:42
If you use vim try syntastic. It enables lint checks on save for a lot of languages. I can't live without it anymore.
10
Name:
Anonymous
2012-09-12 18:45
I started reading K&R.
Disgusting pig.
11
Name:
Anonymous
2012-09-12 19:13
>>10
K&R is fine. What the fuck is wrong with you?
12
Name:
Go
2012-09-12 20:12
#include <unistd.h>
int main(void)
{
write(1, "Do it right, idiot!\n", 20);
return -1;
}
13
Name:
Anonymous
2012-09-12 20:13
>>11
I'm not a disgusting pig, that's what's right with me, pig.
14
Name:
Anonymous
2012-09-12 20:44
>>12
return -1;
Le undefined behavior.
15
Name:
stderr
2012-09-12 21:07
>>14
What are you using? It compiled just fine for me.
16
Name:
Anonymous
2012-09-12 21:11
17
Name:
postimage.org/image/my6r4flen/
2012-09-12 21:50
>>16
Why would I be?
$ tee > test.c
#include <unistd.h>
int main(void)
{
write(1, "Do it right, idiot!\n", 20);
return -1;
}
$ gcc test.c
$ ./a.out
Do it right, idiot!
$
18
Name:
Anonymous
2012-09-12 22:06
>>13
GNU style is the one that's suppose to be pig. You must be new here.
19
Name:
Anonymous
2012-09-12 22:07
>>15
obviously, -1 is still an int dummy.
20
Name:
Anonymous
2012-09-12 22:16
>>17
What's the value of
$??
21
Name:
Anonymous
2012-09-12 22:37
>>18
Both are pig, idiot, do you even know what K&R is?
22
Name:
Anonymous
2012-09-12 23:28
>>14,20
U mena implementation defined?
>>19
Many (all?) Unices use only 8 bits to store the return value.
23
Name:
Anonymous
2012-09-12 23:39
>>21
Yes, asshole. GNU is pig, always has been. K&R is not the greatest style, certainly, but it's not pig, either.
IHBT
24
Name:
Anonymous
2012-09-13 1:26
>>22
Many (all?) Unices use only 8 bits to store the return value.
Specified by SUS, yes.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html
25
Name:
Anonymous
2012-09-13 3:36
>>19
That's for the shell to interpret.
>>1 will get it later.
26
Name:
Anonymous
2012-09-13 4:23
>>23
You truly have, pig. Enjoy your undefined shit.
27
Name:
Anonymous
2012-09-13 8:43
>>26
May you hang from the highest gallows for your blasphemy.
28
Name:
Anonymous
2012-09-13 10:23
>>27
Yeah I know you jews love hanging anyone and everyone after they notice you've robbed them.
29
Name:
Anonymous
2012-09-13 10:38
>>28
This discussion has fuck-all to do with Jews. Take your autism back to /newpol/.
30
Name:
Anonymous
2012-09-13 10:59
31
Name:
Anonymous
2012-09-13 11:07
Symta:
open FileName | <[T:@4,utf8 L:@4,ul D:@L,y? @Xs]=[[T D] @Xs,r]>
C/C++:
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef struct chunk {
uint8_t Tag[5];
uint32_t Len;
uint8_t *Data;
struct chunk *Next;
} chunk;
chunk *loadChunks(char *FileName) {
int I, L;
uint8_t *D, *P, *E;
chunk *C=0, *T, *N;
FILE *F = fopen(FileName, "r");
fseek(F, 0, SEEK_END);
L = ftell(F);
D = P = (uint8_t *)malloc(L);
E = P+L;
fseek(F, 0, SEEK_SET);
fread(D, 1, L, F);
fclose(F);
while (P < E) {
T = (chunk *)malloc(sizeof(chunk));
memcpy(T->Tag, P, 4);
T->Tag[4] = 0;
P += 4;
T->Len = *(uint32_t *)P;
P += 4;
T->Data = (uint8_t *)malloc(T->Len);
memcpy(T->Data, P, T->Len);
P += T->Len;
T->Next = C;
C = T;
}
for (T = 0; C; C = N) {
N = C->Next;
C->Next = T;
T = C;
}
free(D);
return T;
}
32
Name:
Anonymous
2012-09-13 11:07
>>30
Hello
! Lovely day, innt? Be sure to give my regards to Miss Woolsworth, she's feeling a bit under the weather I've been told.
33
Name:
Anonymous
2012-09-13 12:49
34
Name:
Anonymous
2012-09-13 13:25
>>33
Is that a picture of you, dear sir? You look quite tired.
35
Name:
Anonymous
2012-09-13 16:19
NetBeans!
36
Name:
Anonymous
2012-09-14 8:46
>>1
You can do this in Python
To add } at the end:
print '}'
To create printf statement:
print r'printf("hello, world\n")'
37
Name:
Anonymous
2012-09-14 10:11
>>1
You can do this in D
TO add } at the end:
write('}');
To create printf statement:
write(r"printf("hello, world\n")");
38
Name:
Anonymous
2012-09-14 11:25
39
Name:
Anonymous
2012-09-14 11:32
>>1
You can do this in C++
To add } at the end:
cout << '}';
To create print statement:
cout << "printf(\"hello, world\\n\")";
40
Name:
Anonymous
2012-09-14 11:34
>>1
Most Emacs programming modes provide this functionality.
But you have just admitted to being a slow unskilled typist, and should be ashamed.
41
Name:
Anonymous
2012-09-14 12:23
>>1
This can be done in Haskell
...
Just kidding, every knows Haskell is only good for fibs.
42
Name:
Anonymous
2012-09-14 13:46
>>40
How can I improve myself?
And even though doing this "from general to particular" thing may be slow, it's much more intuitive for me. When thinking before coding is how the functions form in my head. And I also believe it makes it much harder to miss any ) or }
43
Name:
Anonymous
2012-09-14 22:15
>>38
emacs with paredit
redit