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

The C Programming Language

Name: Anonymous 2011-10-24 21:45

Let's have a thread for the C programming language. It's an excellent language.

Name: Canada Goose uk 2011-11-03 23:34

Just to say,I am glad to read so good article in the webstie.<a href="http://www.canadagoosemart.org">Canada Goose parka</a> Well,OK.I have to say,what a wonderful blog it is.thank you for your sharing so good articles in the website.I like it very much.It is very interesting in it<a href="http://www.canadagoosemart.org/canada-goose-yorkville-parka">Canada Goose Yorkville Parka</a> .Look forward to reading so good articles in the website.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 4:44

>>78
If you have a hundred mentions of single number its easier to set it to constant.
Since JsvsScript lacks #define const are the closest thing to control large amount of same numbers at once.
Note;blindly replacing every number with a named constant is useless. Its meant for chunks of code that use that number for one purpose.
Its like:
you have code which adds 3.5 to 8 variables. Instead of writing 3.5 every time you change the line you can make it a const ADD_NUMBER_35
when time is to change ADD_NUMBER_35 to 10 you just change one line.

Name: Anonymous 2011-11-04 7:53

>>39
there's a way to do this without polluting the global scope (which is better than your 'best' way).
define a struct which has a pointer to the data and a write lock handle.

Name: Anonymous 2011-11-04 8:11

you have code which adds 3.5 to 8 variables. Instead of writing 3.5 every time you change the line you can make it a const ADD_NUMBER_35
when time is to change ADD_NUMBER_35 to 10 you just change one line.
I laughed out loud, slapping meself on my meaty thighs!

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 8:16

>>83
I don't trusts struct and such OOP terms as "polluting the global scope"(especially when your goal is to provide global access to a region of memory)
you're polluting your mental scope with structs and reifications of things.
In fact, have you ever wondered how you allocate a struct or select one?
Do you ignore the complexities you create in your mindless quest for "pureness of form"?

Name: Anonymous 2011-11-04 9:16

the practice of NAMING_CONSTS_LIKE_THIS is fucking retarded

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 9:42

>>86
You don't have to use them. If its effective for its purpose and looks ugly, its still useful for some things.
Changing constant numbers in 70 places by hand is far more "fucking retarded" than my single #define

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 9:48

The names looks "CAPS LOCK ugly" to catch attention, so you will never accidentally confuse it with a normal variable like
addnumber35(which is modified by program) vs ADD_NUMBER_35  (which is set and changed by you only).

Name: Anonymous 2011-11-04 9:54

>>88
Why would you ever define ADD_NUMBER_35 to be 10?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 9:59

>>89
Because I hack programs. There two ways to quickly change programs, use some text replace on block of text or just change a couple of controlling constants(you don't usually touch anything named with capslock(its like a Hazard sign to avoid accidental changes)).
In large programs changing #defines is far faster than using text replace or manually rewriting the parts of code with these constants.

Name: Anonymous 2011-11-04 10:02

>>88

i'd rather have my code less ugly than have it immediately apparent which things are constants. i realize i'm in the minority as most people use YELLING_AT_YOU const naming style

Name: Anonymous 2011-11-04 10:10

>>90
I am not questioning the usefulness of constants. That damn constant has ``35'' in its name, why would you ever change it to 10‽

Name: Anonymous 2011-11-04 10:14

>>79
Huh?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 10:21

>>92
35 is placeholder for what value supposed to be intially. It could change at the course of the program, but most likely you'll change it back to default value (that being 35). I see no problem  with #define ten 10000 as long as its useful to change ten.
example you have a huge array operation inlined and referenced in several places with
x[i]
x[i+1]
x[i+2]...
But suddenly you want to change format of underlying array for performance testing
instead of hunting down where +1 or +2 reside and manually setting them to +4 +8 , you just change
ADD2 to 8 and ADD1 to 4, and entire program works as expected.
If you don't like it you just change the constants back to 1 and 2.

Name: Anonymous 2011-11-04 10:28

>intially
C rots the brain

Name: Anonymous 2011-11-04 10:42

>>94
You should use some symbolic name then, such as ADD_NUMBER_A or ADD_FIRST_NUMBER, then have a comment next to the definition describe what the value should do. Putting the literal in the name of a value that's going to be changed in the future is utterly retarded.

Name: Anonymous 2011-11-04 10:43

>>93
The code has to follow the algorithm they give.

Although that particular benchmark is not really about programming languages but "which programming language has the fastest PCRE binding", given what the submissions are. A good implementation of the Thompson algorithm would probably beat the JS one (which is also not PCRE but Google's own.)

I saw this posted on /prog/ too:
http://swtch.com/~rsc/regexp/regexp1.html

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 10:52

>>96
 if you want to modify it, you'll have to adapt to some quirks of naming conventions.
I don't want to change some number 99% of the time, and i want to have reminder in case i change it.
ADD_NUMBER_35 //contains default number embedded in itself
ADD_NUMBER_ARRAY_OP_HFIX_NEW// contains zero information beside its location.
If you have one ADD_NUMBER_ARRAY_OP_HFIX_NEW its fine to remember what values it should have,but what if you have 3-4 such similar named constants like  ADD_NUMBER_ARRAY_OP_MFIX_NEW? What makes them different? Thats just useless semantic noise.

Name: Anonymous 2011-11-04 11:10

>>98
If you don't think you'll be changing it, then leave it as a literal. Otherwise, give it a meaningful name that does not include its literal value.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 11:17

>meaningful name that does not include its literal value.
I'm not going to waste time at inventing a name for every single const or variable.
Names should be self-descriptive about their content.

Name: Anonymous 2011-11-04 11:19

>>100
Then it'll only confuse you later on when you try to maintain old code. Even if you're somehow able to deal with that, anyone else looking through your code likely won't.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-04 11:22

>>101
I'm not maintaining anything.I'm not a software developer.

Name: Anonymous 2011-11-04 11:23

Source code readability is unscientific and ultimately destructive.

Name: Anonymous 2011-11-04 11:35

>>102
Not a reason not to write good-looking code.
But whatever. Do as you want.

Name: Anonymous 2011-11-04 11:35

>>101
Please stop responding to the invisible poster. It unsettles me greatly.

Name: Anonymous 2011-11-04 11:38

>>105
Good to know, I'll make an effort to answer him more often.

Name: Anonymous 2011-11-04 11:46

>>105
I could include the whole content of his posts in mine, if you're unable to view them.

Name: Anonymous 2011-11-04 11:48

>>107
That's a nice idea too.

Name: Anonymous 2012-11-09 15:27

>>11
First link still works but second is dead. Thought I'd let you all know.

Name: Anonymous 2012-11-09 15:50

>>33
static memory allocation is contiguous. Dynamic memory allocation isn't. So you can create linked lists and such using dynamically allocated memory.

Name: Anonymous 2012-11-09 15:51

>>11
linking to library.nu
That is wrong man. FUCK YOU

Name: Anonymous 2012-11-09 16:07

>>111
;_;

Name: Anonymous 2012-11-09 16:10

Name: Anonymous 2012-11-09 17:59

>>113
I know about this and the other mirrors. It's not the same as library.nu.

Name: Anonymous 2012-11-09 18:13

>>114
what kind of hipster books are you trying to download?

Name: Anonymous 2012-11-09 19:47

>>32
`` http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1516.pdf ! ''

``7.25 Threads <threads.h> . . . . . . . . . . . . . . . . . . . 372''

Name: Anonymous 2012-11-09 20:13

C is ancient worse-is-better shite, much like this thread.

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