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

Procedural vs Functional

Name: Anonymous 2010-11-18 16:26

Which is better from a C language standpoint?

Name: Anonymous 2010-11-18 16:27

Sticking to a single paradigm considered harmful

Name: Anonymous 2010-11-18 16:38

The D Programming Language features both Procedural and Functional paradigms.

Name: Anonymous 2010-11-18 17:25

>>1-3,5-1000
samefag

Name: Anonymous 2010-11-18 18:37

C does not have nested functions, so you cant use functional programming features like first class functions or closures. The only functional feature it does have is recursion.

Name: Anonymous 2010-11-18 18:53

>>5
gcc can support nested functions as an optional nonstandard extension to C

Name: Anonymous 2010-11-18 18:59

why would anyone use nested functions

Name: Anonymous 2010-11-18 19:05

Because they want to program in Lisp in [non-Lisp language here].

Name: Anonymous 2010-11-18 22:14

>>5
Function pointers work fine for me.

Name: Anonymous 2010-11-19 2:15

When I was 12 I thought that functional and procedural programming is the same thing.

Name: Anonymous 2010-11-19 6:09

>>6
They are not first class and work nothing link closures. You can't have a function that returns a nested function, and with C's stack model I don't see this being implemented anywhere ever.

Name: VIPPER 2010-11-19 7:44

>>11
You can't have a function that returns a nested function, and with C's stack model I don't see this being implemented anywhere ever.

Maybe im a noob, but from what i know you can specify a calling convention at definition, which by theory one could circumvent the stack model.
Asuming you implement it in the compiler.

also JEWS

Name: Anonymous 2010-11-19 7:47

Assuming that your implementation is even using a stack.

Name: Anonymous 2010-11-19 7:53

>>11
With C's development model, I don't see anything remotely interesting being implemented anywhere ever.

It took them 10 years to add complex numbers in C99, and they still kept the shitty, unsafe standard library as incomplete and terrible as ever, no Unicode support, no lists, shitty arrays, not even safe integer sizing or god fucking overflow, let alone any attempts to bring decent programming features to C.

And now the C1X guys are wasting their time on alignment control, sad generics and their shitty attempt for Unicode support, the only useful addition being threads (in 201X, lol) and perhaps bounds checking (but go figure how this will be implemented), and oooh, incredible, they've added gets_s to the standard library! Now it's like, 20 times better.

C is dead. Use it as portable assembly for calling anything else, and leave it alone.

Name: !Dee.heHMhc 2010-11-19 8:00

Use The D Programming Language for mid-level stuff, C for low-level stuff.
You'll be enlighted.

Name: Anonymous 2010-11-19 8:20


#define cbrt(X) _Generic((X), long double: cbrtl, default: cbrt, float: cbrtf)(X)


This can be useful, but C is looking more and more like C++, with thousands of special keywords to do things.
I'll stick to my C89 with a couple of C99 extensions.

Name: Anonymous 2010-11-19 9:27

>>15
Mid-level means you don't care for speed (hence not low-level), yet you're stupid enough not to use the more powerful languages available.

Name: Anonymous 2010-11-19 9:37

>>17
They are all Touring-complete

Name: Anonymous 2010-11-19 10:01

>>16
I also stick to plain C89. One funny thing about C1X's _Generic is that it's inspired by how EDG implemented C99's <tgmath.h>, so C is sort of developing as a feedback loop at this point.

Name: Anonymous 2010-11-19 10:09

C WITH TEMPLATES!

Name: VIPPER 2010-11-19 11:18

>>14
The shitty stdlib doesnt mean that C is shitty.
C is nice is a nice language to express low level processes.
And array bound checking is not good at all, some times it is usefull to access elements that are out of "bound".

Name: Anonymous 2010-11-19 11:21

Arrays are just pointers.

Name: Anonymous 2010-11-19 11:21

>>21
Yeah, if you're looking to trigger a segmentation fault, for example.

Name: VIPPER 2010-11-19 11:32

>>23
Happens only when you dont know what your program is doing.

Name: Anonymous 2010-11-19 12:22

>>24
I.e. it's true for 99% of programs

Name: Anonymous 2010-11-19 12:27

>>25
<i>citation needed</i>

Name: Anonymous 2010-11-19 12:56

>>26
You clearly don't know what the program interpreting your BB[m]code is doing.

Name: Anonymous 2010-11-19 17:26

Bb.u.o BCODE

Name: Anonymous 2010-11-20 3:47

>>21
The shitty stdlib plagues C. C isn't a nice language to use if you can't even use its own "built-in" so to speak strings which are non-Unicode, non-binary-safe, O(n) strlen bullshit with no library to work with. It's not bad for low-level processes, as long as by that you mean a portable assembler to micromanage byte alignments (which is done through hordes of messy hacks, typedefs because its types suck, compiler options and gotchas). As for array bound checking, sometimes it's useful to access elements that are out of bound for what? Ugly hacks and ugly hacks alone.

C should be limited to portable assembly, operating systems and magic glue when no other thing will do; no serious application should be written in it.

>>22
And the exposure of pointers is yet another of C's shitty features.

>>24
Yeah, whatever. C code is the source of most of today's exploits.

Name: VIPPER 2010-11-20 4:16

>>29
Well you are right i guess. Never the less C fills a hole that no other language could fill. And i assume many programs will still be writen in it.

Name: Anonymous 2010-11-20 4:28

>>29
ENTERPRISE DEVELOPER detected.

Name: Anonymous 2010-11-20 8:03

>>29
Sloppy code is the source of most of today's exploits.

Name: Anonymous 2010-11-20 9:47

>>30
I don't know, I'm banking my money on BitC. BitC and Scheme.

Name: Anonymous 2010-11-20 18:44

>>30
C fills a hole that no other language could fill.
I sure as hope you mean for political reasons. We badly need a language that's like C but without all the brain damage.

Name: Anonymous 2010-11-20 18:50

The D Programming Language is all you need!

Name: Anonymous 2010-11-20 18:52

>>34
Yeah. It's not even like C is a portable assembly, there's tons of ASM stuff that you simply can't do in C, portable or otherwise. Now, had Forth or Lisp machines become status quo, everything would be fine.

Name: Anonymous 2010-11-21 12:34

>>36
Lisp is terrible.

Name: Anonymous 2010-11-26 0:19


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