Search Amazon.com:
Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us $3,400 per month for bandwidth bills alone, and since we don't believe in shoving popup ads to our registered users, we try to make the money back through forum registrations.
  • Post
  • Reply
fartmanteau
Mar 15, 2007
technophiliac

beuges posted:

I just got this email last monday:

quote:


Please re-read the ROT (attached) that I sent out 3 years ago, ESPECIALLY the sections about indentation. Specifically, BE CONSISTENT.

If you are working with a lot of different people's/projects' code, as in, not from within your group with the pristine coding conventions, BE CONSISTENT is a simple and effective rule of thumb. What pisses people off most is combining spaces and tabs. An unbelievable lot of people carelessly miss this. Consistency takes precedence over whatever convention agenda you want to push. Be considerate and make that simple adjustment in your editor whenever possible.

On the other hand, some OSS projects are just crap. Sometimes I would make a clean patch, but then mess it up before committing just to be consistent.

Adbot
ADBOT LOVES YOU

fartmanteau
Mar 15, 2007
technophiliac

Avenging Dentist posted:

Realtalkin', I wish I knew how to build parse tables manually. Maybe one of these days I should get a book on lexing/parsing.

I suggest some reading on the lemon parser. Quite educational.

fartmanteau
Mar 15, 2007
technophiliac

Well AD's code wasn't "pure-C", but Otto Skorzeny's link explains it well.

edit: efb by edit

fartmanteau
Mar 15, 2007
technophiliac

riggsninja posted:

But that puts it on the stack, right? If I need the array on the heap, is there a trick for doing something similar? Or once I malloc, do I need to go through arr[0].a = 1; arr[0].b = 2; arr[0].c = 3;... ?

Well you can build the struct on the stack like you're doing, malloc() your destination heap memory, then memcpy() from stack to heap. Put that code in a function to clean up memory after. But that would be kinda roundabout. If your purpose is just to pretty your code, it doesn't really matter.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply