Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

C editor

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?

Name: Anonymous 2012-09-12 14:29

vim does that with plugins.

Name: Anonymous 2012-09-12 14:32

reviewing with syntax highlighting should be good enough

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.

Name: Anonymous 2012-09-12 14:35

yeah, it's called vim macros

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

Name: Anonymous 2012-09-12 14:38

Vim be it then.
Thank you

Name: Anonymous 2012-09-12 15:23

>>4
* African Americans

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.

Name: Anonymous 2012-09-12 18:45

I started reading K&R.
Disgusting pig.

Name: Anonymous 2012-09-12 19:13

>>10
K&R is fine. What the fuck is wrong with you?

Name: Go 2012-09-12 20:12


#include <unistd.h>
int main(void)
{
   write(1, "Do it right, idiot!\n", 20);

   return -1;
}

Name: Anonymous 2012-09-12 20:13

>>11
I'm not a disgusting pig, that's what's right with me, pig.

Name: Anonymous 2012-09-12 20:44

>>12
return -1;
Le undefined behavior.

Name: stderr 2012-09-12 21:07

>>14
What are you using? It compiled just fine for me.

Name: Anonymous 2012-09-12 21:11

>>15
better be trolling

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!
$

Name: Anonymous 2012-09-12 22:06

>>13
GNU style is the one that's suppose to be pig. You must be new here.

Name: Anonymous 2012-09-12 22:07

>>15
obviously, -1 is still an int dummy.

Name: Anonymous 2012-09-12 22:16

>>17
What's the value of $??

Name: Anonymous 2012-09-12 22:37

>>18
Both are pig, idiot, do you even know what K&R is?

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.

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

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

Name: Anonymous 2012-09-13 3:36

>>19
That's for the shell to interpret. >>1 will get it later.

Name: Anonymous 2012-09-13 4:23

>>23
You truly have, pig. Enjoy your undefined shit.

Name: Anonymous 2012-09-13 8:43

>>26
May you hang from the highest gallows for your blasphemy.

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.

Name: Anonymous 2012-09-13 10:38

>>28
This discussion has fuck-all to do with Jews. Take your autism back to /newpol/.

Name: Anonymous 2012-09-13 10:59

>>29
Shalom!

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;
}

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.

Name: Anonymous 2012-09-13 12:49

Name: Anonymous 2012-09-13 13:25

>>33
Is that a picture of you, dear sir? You look quite tired.

Name: Anonymous 2012-09-13 16:19

NetBeans!

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")'

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")");

Name: Anonymous 2012-09-14 11:25

>>1
Emacs with Paredit.

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\")";

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.

Name: Anonymous 2012-09-14 12:23

>>1
This can be done in Haskell

...

Just kidding, every knows Haskell is only good for fibs.

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 }

Name: Anonymous 2012-09-14 22:15

>>38

emacs with paredit
redit

Don't change these.
Name: Email:
Entire Thread Thread List