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

Pages: 1-4041-8081-120121-160161-200201-

What would you change in C?

Name: Anonymous 2009-08-26 13:44

It's the time for the next revision of the C standard and for some reason they want your advice. What do you add, remove, rename, etc ?

Name: Anonymous 2009-08-26 13:46

Add OOP.

Name: Anonymous 2009-08-26 13:49

>>2
as a design criteria rather then a bolt-on

Name: Anonymous 2009-08-26 13:49

>>2
I LOVE YOU! I LOVE YOUR POST! I READ IT 5 TIMES! KEEP POSTING!

Name: Anonymous 2009-08-26 14:00

Inline Python support.

Name: Anonymous 2009-08-26 14:03

Add namespaces

Name: Anonymous 2009-08-26 14:08

>>6
Ding-ding-ding-ding-ding! We have a winner! I'm tired of writing "MyLib_MyFunc()" everywhere.

Name: Anonymous 2009-08-26 14:18

>>7
What syntax would you use? I'd be tempted to just steal Seppples', but I think you could probably get away with hacking the preprocessor to do it instead(using #export and #use or something similar)

Name: Anonymous 2009-08-26 14:27

* Remove pointers
* Add compulsory garbage collection, remove free()
* Get rid of the shitty format strings ("%d %s\n")
* Trash the preprocessor

Name: Anonymous 2009-08-26 14:28

Change the syntax so that all types are capitalized, and all other identifiers are lowercase. Or change the type declaration syntax altogether.

Name: Anonymous 2009-08-26 14:30

>>9
congratulations, you've invented the worst systems programming language ever to exist. I hope your happy.

Name: Anonymous 2009-08-26 14:32

>>10
For a second I almost said "LIKE JAVA?!" but then I realized U actually MENA HASKAL.

Name: Anonymous 2009-08-26 14:34

>>9
* Remove pointers
Why would you do that?

Name: Anonymous 2009-08-26 14:37

>>8
MyLib.h

#ifndef MYLIB_H
#define MYLIB_H

namespace MyLib
{
    void MyFunc();
}

#endif


MyLib.c

#include "MyLib.h"

namespace MyLib
{
    void MyFunc()
    {
    }
}


Client.c

#include <MyLib.h>
using namespace MyLib;

int main()
{
    MyFunc();
    // or explicitly
    MyLib.MyFunc();
    return 0;
}

Name: Anonymous 2009-08-26 14:40

>>14
So, just like Haskell.

Name: Anonymous 2009-08-26 14:49

>>13
Because he is a shitty programmer.

Name: Anonymous 2009-08-26 15:45

>>13
Cause all the kewl pr0gramm3r5 use references AMIRITE?

Name: Anonymous 2009-08-26 15:45

>>2
>>6
>>10
Also true modules, none of this #include "somefile.h" shit (at least not as the only way to split code between compilation units; I'd leave the preprocessor as it is).

Name: Anonymous 2009-08-26 15:50

>>13
Because he's an idiot. All four of his suggestions are shit.

Name: Anonymous 2009-08-26 20:33

some kind of built in dynamic array.

Name: Anonymous 2009-08-26 20:37

nothing

Name: Anonymous 2009-08-26 21:46

Lazy evaluation. Higher order functions. Currying. Algebraic data types.

Name: Anonymous 2009-08-26 21:52

I would remove most of the shit in C99 that nobody has implemented anyway. Other than that, C is perfect and changing it requires renaming the result because it isn't C. I will admit, however, that adding namespaces and function overloading would be nice.

Name: Anonymous 2009-08-26 21:54

>>23 here: I would also like to see someone implement function overloading by return type.

Name: Anonymous 2009-08-26 21:57

Macros that don't suck are the thing it needs most, but the problem with C is that it's not actually powerful enough to write macros in, so any macro system would need to be a completely different language. Ugh.

Name: Anonymous 2009-08-26 22:02

C is the most optimization-friendly language. That is the only thing I care about.

Name: Anonymous 2009-08-26 22:03

A ** exponent operator might be nice.

Name: Anonymous 2009-08-26 22:06

>>27
idiot

Name: Anonymous 2009-08-26 22:24

>>27
That would make it so that x ** y could either mean pow(x, y) or mul(x, *y). This ambiguity is unacceptable, because no compiler can tell the difference.

Name: Anonymous 2009-08-26 22:25

>>29
just use ^ instead.

Name: Anonymous 2009-08-26 22:29

>>30
^ is XOR which I think is a lot more useful than exponentation.

Name: Anonymous 2009-08-26 22:40

>>29
Personally I would rather have function calls than operators anyway.
div(add(neg(b), sqrt(sub(pow(b, 2), mul(4, mul(a, c))))), mul(2, a))

Name: Anonymous 2009-08-26 22:42

#deffine operators! oh wait we can do that already

Name: Anonymous 2009-08-26 22:56

>>32
Back to /scheme/, please.

Name: Anonymous 2009-08-26 23:10

>>34
/scheme/ is just a symlink to /prog/

Name: Anonymous 2009-08-27 1:38

>>30
What about ^^^?

Name: Anonymous 2009-08-27 3:28

>>24
C's type conversion rules are already enough of a pain to remember without adding even more confusion. I never liked overloaded function arguments either, for this exact same reason.

>>36
There's the question of why you'd want an exponentiation operator in a systems programming language in the first place. Use FORTRAN for maths please.

Name: Anonymous 2009-08-27 3:32

I'd like to add the following:

1) A universal way to link libraries, i.e:
#inclib("libc");

2) Standard GUI , like allegro etc, but as a standard c library.

3) Standard Sound , sort of the same as the above.

4) Allocation function, like malloc, but that you can choose the virtual offset, like VirtualAlloc on windows.

Name: Anonymous 2009-08-27 3:35

>>38
OHHHH, also a Standard C Library for multi threading and chmod etc.

Name: Anonymous 2009-08-27 3:39

>>1
D is the next revision of the C.

http://www.digitalmars.com/d/

Name: Anonymous 2009-08-27 4:45

>>29
good point, i didn't think of that.
i just said ** because that's what they use in perl

Name: Anonymous 2009-08-27 6:18

>>38-39
Bawww low-level languages aren't high-level ones.

Name: Anonymous 2009-08-27 8:36

Make <frozen.h> a part of the standard of the standard library (includes common headers, etc..)

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !fRoZeNHN4I 2009-08-27 12:28

I personally use Notepad2 and avoid any "makefiles"(which i consider bloated and poor design)[1]

I use one include file for everything.
#include "void.h" //handles all the common functions,#defines,#ifdefs and #includes[2]

Anything which uses makefiles is defective Sepples-level shit.
All the C code posts on my blog are void.h merged with somefile.c

-
References:
1. http://dis.4chan.org/read/prog/1250330533/ >>10
2. http://dis.4chan.org/read/prog/1250330533/ >>12

_____________________________________
http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
My Blog: http://frozenvoid.blogspot.com/
The primitive mentality is a condition of the human mind, and not a stage in its historical development.

Name: Anonymous 2009-08-27 15:08

>>42
Um, excuse me >>42-san, but C is a high-level language desu yo~~

Name: Anonymous 2009-08-27 15:16

>>45 YHBT

Name: Anonymous 2009-08-27 16:08

Hax my anubis.

Name: Anonymous 2009-08-27 16:10

>>44
Where have you been , anus?

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !fRoZeNHN4I 2009-08-27 16:21

>>48
writing a infinite compression algorithm in C

_____________________________________
http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
My Blog: http://frozenvoid.blogspot.com/
« our array warning sensors can help us, for the mind worms infiltrate through every crevice and chew through anything softer than plasma-steel. »

Name: Anonymous 2009-08-27 16:37

>>49
Well get back to work and don't post on /prog/ again until you're finished. Focus!

Name: Anonymous 2009-08-28 2:54

C ought to have (optional) structural type equivalence, whole program type inference, bound-checked array types, and syntax based on Pascal.

Name: Anonymous 2009-08-28 3:25

>>51
FUCK PASCAL SYNTAX. The only thing worse is BASIC syntax... "If x Then Nothing() End If" is such an eye sore.

Name: Anonymous 2009-08-28 3:28

>>52
Okay, how about Ruby syntax then

Pickle surprise!

Name: Anonymous 2009-08-28 3:31

>>51
i think bound checked arrays would conflict with malloc() and such.

Name: Anonymous 2009-08-28 12:44

I would make bumping part of the C standard

Name: Anonymous 2009-08-28 13:57

>>54
No. When allocating a bound-checked array, you pass malloc() the size of the actual data, plus the size of a pointer to the last element. Or just the length of the data, I suppose, if you can manage a type system that handles it well enough. That way, it's one contiguous block of memory that you can free() whenever needed.

There should still be "raw" arrays so programmers can shoot their toes off, but there should also be a typesafe foreach loop of some sort to give them the opportunity not to pump their shoes full of lead.

Name: Anonymous 2009-08-28 14:32

>>52
Yes, everyone can agree that BASIC is terrible, but you don't like Pascal's syntax? Seriously?

Name: Anonymous 2009-08-28 14:56

>>57
He's not the only one

Name: Anonymous 2009-08-28 17:09

>>58
Why is Pascal not your favourite programming language?

Name: Anonymous 2009-08-28 19:05

I'd add objects and add several new methods to the standard library.

Name: Anonymous 2009-08-28 19:40

>>26
No that's ASM

Name: Anonymous 2009-08-28 19:52

>>59
Pascal has AIDSful semantics. It adheres too closely to the philosophy of structured programming, which is basically a misguided attempt to implement an FP-style data flow in an imperative context.

Name: Anonymous 2009-08-28 20:22

>>62
IHBT

Name: Anonymous 2009-08-28 20:45

>>63
Actually, >>62-chan makes an eerie sort of sense. Structured programming restricts you to one straightforward control flow through any given procedure, including one return statement. It's basically an elaboration on "GOTO considered harmful"

Name: BWK Wilson Kernighan 2009-08-28 20:47

>>62
It seems you missed the reference.

Name: Anonymous 2009-08-28 20:50

Structured programming considered harmful and ultimately destructive.

    '-._                  ___.....___
        `.__           ,-'        ,-.`-,            HAVE YOU READ
            `''-------'          ( p )  `._       YOUR TURBO PASCAL TODAY ?
                                  `-'      (
                                            \
                                  .         \
                                   \---..,--,
       ................._           --...--,
                         `-.._         _.-'
                              `'-----''

Name: Anonymous 2009-08-28 22:09

Uhh, personally, I'd just make D compilers better, instead.

Barring that, namespaces.

Name: Anonymous 2009-08-29 0:13

>>67
D is OOP shitsteak. I for one want nothing to do with it.

Is there ANYONE still designing languages that don't jump on the OOP bandwagon?

Name: Anonymous 2009-08-29 0:18

>>68
Your options (with modern compilers) are C, Haskell, Erlang, Scheme.....

....Uhm, assembly?

So basically, no.

Name: Anonymous 2009-08-29 0:44

>>68-69

OOP in its purest form is just one way to abstract. It may work for some types of programs (window managers, games, large frameworks,...), but for others it may be unneeded. OOP is good when it's not forced and suits the problem domain, but at the same time you can use it or implement it without the language having support for it. You can write in an OOP manner in C, by just designing data structures and making functions which operate on them. Add some tagging/inheritance mechanism using the structures fields and you have OOP. On more capable languages like Lisp-based languages, it's possible to implement OOP in the language itself, even though CL has CLOS in the standard, but actually implementing a simple message passing interface can be done in a page or two of code. I think that CLOS' way of not forcing methods to be connected with data structures gives you what's best of OOP: extensibility, without actually having to forcibly link that method to some data structure. That way generic operators can be designed which work with all kinds of objects. The most common example of such an operator would be generic arithmethic operations:
(+ fixnum fixnum)
(+ fixnum integer)
(+ bignum bignum)
(+ bignum integer ... bignum) and so on, the actual result's type depends on the input's actual data.

What I'm getting at is that OOP is not bad by itself, and it should be used where it provides some advantage, but it should never be forced or unnecessarily restricted by other concepts. If you keep OOP as just a generic way to extend functions and keep structures with (single or multiple) inheritance of fields/slots separate, then it's fine.

What's called OOP in these days, C++, Java, is nothing more than a forced combination between the concept of method and structures with inheritance, which by itself is a common usage of OOP, but as a general concept it's bad and just leads to people inventing patterns to work around this forced limitation.

Name: Anonymous 2009-08-29 1:13

>>69
Lisp, Factor, APL....

Name: Anonymous 2009-08-29 1:52

>>68
Lua did OOP right in my opinion, by implementing inheritance as a simple assignment of metatables containing methods and data. This is a vast improvement over strict OOP because it can flex when you need it to without complicated polymorphism or more obscure methods of using OOP to solve problems that are almost, but not quite, perfectly suited to OOP. When the problem fits well in the domain, great; when it doesn't, that's fine, too.

Name: Anonymous 2009-08-29 2:14

>>72
OOP design is fucking easy when you use UML. I have absolutely no problem using Java or C++ when I write my code because I code it to my system design. It sounds like you write code without any formal system design. Hacking non-trivial systems in this manner is a waste of time and gives you problems just as you describe.

Name: Anonymous 2009-08-29 2:22

>>73
fuck, I'm supposed to draw a bunch of diagrams every time I write a program?  Fuck OOP.

Name: Anonymous 2009-08-29 2:28

>>73
Protip: not everything is a fucking object.

Name: Anonymous 2009-08-29 2:36

>>73
UML
IHBT

Name: Anonymous 2009-08-29 2:57

>>74
Exactly. Draw a bunch of boxes, write some labels in them, and then complete with arrows. It is fucking easy and removes any doubt about the class logic.

>>75
That's right.

Name: Anonymous 2009-08-29 4:29

i, for one, enjoy UML.

Name: Anonymous 2009-08-29 4:35

UML leverages core skillsets and world-class diagrams to provide clients worldwide with robust, scalable, modern turnkey implementations of flexible, personalized, cutting-edge Internet-enabled e-business application product suite e-solution architectures that accelerate response to customer and real-world market demands and reliably adapt to evolving technology needs, seamlessly and efficiently integrating and synchronizing with their existing legacy infrastructure, enhancing the e-readiness capabilities of their e-commerce production environments across the enterprise while giving them a critical competitive advantage and taking them to the next level.

Name: Anonymous 2009-08-29 5:48

More precisely and usefully defined semantics for "volatile", memory barriers, multithreading and similar things a modern systems programming language needs.

Rules for the more arcane shit in the language rewritten so they're understandable by normal people.

Name: Anonymous 2009-08-29 14:33

I'm not sitting down and drawing some fucking complicated diagrams every time I write code

Name: Anonymous 2009-08-29 15:14

All I want is to be able to evaluate C expressions at the command prompt. Is there a way I can do this on my Macintosh™?

Name: Anonymous 2009-08-29 15:29

>>82
Unfortunately, no, since a Macintosh isn't a real computer

Name: Anonymous 2009-08-29 15:30

>>83
Oh ;_;

Name: Anonymous 2009-08-29 15:32

Name: Anonymous 2009-08-29 16:48

The order of evaluation should be defined.

Name: Zhivago 2009-08-29 17:00

>>86
Order of evaluation has nothing to do with this.

Name: Anonymous 2009-08-29 17:04

case statements shouldn't require constants. const should create compile time constants. a real type system, so things like int string = "string"; or
sin("string");
are not possible. No goto statement.

Name: Anonymous 2009-08-29 17:20

[MC Ren]
Yeah nigga, MC Ren up in this motherfucker
(West West y'all)
Yeah, L.A. niggaz
L.A. niggaz rule the world nigga
Y'all niggaz gotta recognize, yaknahmsayin?
Niggaz don't wanna peep game, yaknahmsayin?
But this shit come all the way back around here
My nigga Dre, droppin heat box on y'all bitch-ass
Yaknahmsayin? You gotta recognize
L.A. niggaz, connected all over the
motherfuckin world, nigga
Recognize this *grabs dick*

[Time Bomb]
Now in my younger days I used to sport a rag
Backpack full of cans plus a four-four mag
G'd from the feet up
Blued up from the sewer's how I grew up
Loc'n, smokin and drinkin til we threw up (threw up)
At Leimert Park, taggin, hittin fools up
Ditchin my class, just to fuck yo' school up
You don't wanna blast, nigga tuck yo' tool up
But don't sleep, y'all niggaz quick to shoot you
Now there's another motherfucker with no future
But Time Bomb much smoother when I
manuever, dope like Cuba
Got em jumpin *King T starts speakin, indecipherable*

[King T]
I'm comin "Straight Outta
Compton" with a loose cannon
Smoke big green, call it Bruce Banner
Watch your manners, at last another
blast from the top notch
From way back with the pop rocks, I pop lock witcha
Picture this, Dr. Dre twistin wit Tha Liks
and Hittman bought a fix
Don't trip, it's a Time Bomb in this bitch
Here it tick tick tick tick *BOOM*
Wait a minute it's on, I tell it like a true mackadelic
Weed and cocaine sold seperate, check it
From sundown to sunup -- clown done run up
The Aftermath'll be two in your gut, nigga what?

Chorus: Knoc-Turn'al, Kokane
[ Find more Lyrics on www.mp3lyrics.org/UNun ]

We roll deep, smoke on weed drink and pack heat
Requirements for survival each day -- in L.A.!
It don't stop, we still mash in hot pursuit from the cops
Analyze why we act this way -- in L.A.!

[Hittman]
Gimme that mic fool, it's a West coast jack move
They call me Hitt - cause I spit like gats do
cock me back
Bust caps for my max crew, at Fairfax
who used to wear Air Max shoes, that's true
But I grew up where niggaz jack you, harass you
Blast you, for that set you claim (where you from?)
Mash on you for your turkish chain, C.K. B.K.
Blued up or flame, I ran wit a gang
I helped niggaz get, jacked for they Dana Dane's
My pants hang below my waistline
I look humble wanna rumble? (yeah yeah)
I bang though, like Vince Carter from the baseline
don't waste my time
Fuck a scrap in killa Cali, AK's and 9's
One-time's, sunshines, and fine-ass bitches
Hawaiian thai, drive-by, six-fo's on switches

[Xzibit]
I was raised in the hood called WHAT-THE-DIF'
Where the brothers in the hood, refused to go Hollywood
Slugs for the fuck of it
Anybody hatin on us can suck a dick
If I catch you touchin mine you catch a
flatline, dead on the floor
Better than yours, drivin away gettin head from a whore
It's AvireX-to-the-Z
Fuckin with me might get you banned from TV,
cassette and CD it's all mine the
whole nine the right time
Multiply, we don't die, the streets don't lie
What, so neither do I, I'm bad for your health
like puttin a pistol up to your face and blastin yourself

[Defari]
Five in the mornin, burglars at my do'
Glock forty-five in my dresser drawer
Let em come in BLAOW he see the thunder roll
Roll with niggaz, who by fifths by the fo'
and bruise by the case
SLAP YOU in the face with the bass, Dr. Dre laced
Likwit Kings wit Sedans and gold rings
Haters fold the style, but can't find no openings

Chorus

[Outro]
In L.A.

Name: Anonymous 2009-08-29 17:34

>>88
As soon as you want a real type system, you're outside the realm of what C is actually for. (Although, you're still inside the realm of what C gets abused for.)

Name: Anonymous 2009-08-29 17:48

>>87
Nothing to do with what?

What would you change in C?

Name: Haxus the Beetrolled 2009-08-29 18:04

>>88
5/10.  IHBT ;(

No goto statement.
Having goto in C isn't harming anybody.  If newbie/retarded programmers accidentally use it then so be it; inexperienced people will make mistakes like that no matter what you take out of the language.  I don't think you have any idea what you're talking about.
case statements shouldn't require constants.
This I might actually agree with.  Someone correct me if I'm wrong to think so.

Name: Anonymous 2009-08-29 21:10

>>88
"A real type system?" I'd rather not put up with your OOP shit. C's types work fine, thank you.

Name: Anonymous 2009-08-30 2:42

the only thing i would change in c would be to get rid of the unnecessary distinction between function types and object types.

Name: Anonymous 2009-08-30 2:49

b u t t s o r t

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !fRoZeNHN4I 2009-08-30 3:02

>>95
here you go


#include "void.h" //handles all the common functions,#defines,#ifdefs and #includes
//including buttsort() and related algorithms

vd main(stdargs){(argc>1)?buttsort(argv[1]);:exit(1);}

_____________________________________
http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
My Blog: http://frozenvoid.blogspot.com/
It requires wisdom to understand wisdom: the music is nothing if the audience is deaf.

Name: Anonymous 2009-08-30 3:09

>>96
Not bad, something useful out of Void!

Name: Anonymous 2009-08-30 3:57

>>40
D is shit

Name: Anonymous 2009-09-01 9:16

>>40
No

>>1
Add Alef

Name: Anonymous 2009-09-01 9:22

>>99
wtf is Alef?

Name: Anonymous 2009-09-01 9:28

>>100
A Jew.

Name: t 2009-09-01 10:05

>>100
These kids today, I don't know...

Alef is/was a language developed at Bell Labs. It's basically C but with more coolish stuff and some cleaning up. It's also a Jewish letter equivalent to A or Alpha.

Name: Anonymous 2009-09-01 10:10

>>102
なるほど

Name: Anonymous 2009-09-01 10:42

>>103
I'm sorry, but I don't read wapanese. I can only assume that you verify my awesomeness

Name: Anonymous 2009-09-01 13:09

>>104

i dont read runes neither

Name: Anonymous 2009-09-01 15:22

>>96
Fuck you.

Name: Anonymous 2009-09-01 17:13

>>102
Nobody cares about Jews.

Name: Anonymous 2010-04-28 12:14

Pachelbel's Canon in Db widdershins.

Name: Anonymous 2010-04-28 17:59

>>103
>なるほど
>Naruhodo
>I see.

Name: Anonymous 2010-04-28 21:32

>>34
Back  to  /b/,  please!

Name: Anonymous 2010-04-28 22:02

>>108
Pachelbel's Canon in Db widescreen.

Name: Anonymous 2010-04-28 22:49

1. allow function types everywhere that incomplete types are allowed.
2. make something like gcc's const function attribute standard.

Name: Anonymous 2010-04-28 23:38

Sounds like what y'all really want is Go.

Name: Anonymous 2010-04-29 0:24

>>113
Certainly not all of us. Though, for those who did want Go, they are probably happy with Go by now.

Name: Anonymous 2010-04-29 2:40

>>114
Well you know what they say. When you gotta go, HAX MY ANUS.

Name: Anonymous 2010-04-29 2:45

>>113
Nobody who wanted Go wants Go. It got lost in the translation.

Name: Anonymous 2010-04-29 5:42

>>116
I'd love to hear what your concerns with it are.

Name: Anonymous 2010-04-29 6:59

>>117
It's made by HAX MY ANUS.

Name: >>116 2010-04-29 7:34

>>117
In a nutshell:
1. You have to game the runtime in order to make sure scheduling is done effectively.
2. I have a collection of dynamically allocated channels I need to poll. The official solution is to spawn a number of goroutines to select on them in static groups because the existing select is O(1) and it would be a shame not to use that, or alter its behavior to cover new areas.
3. It's a concurrent language without a whit of tail call elimination.
4. The near elimination of semicolons is a compromise between the stupid and the unnecessary. It's a flippant decision.

I could go on, but honestly I'd probably STFU if just the above was fixed. #1-3 are dealbreakers, #4 is just supremely annoying.

Name: Anonymous 2010-04-29 11:40

>>92
I thought that's how switch statements are optimized by the compiler. I could be wrong here.

>>1
Scoped pre-processor definitions.
#{
# define hello (int)1
int test(){
    return hello;
}
#}

int test2(){
    return hello; // causes a compiler error, hello is undefined at the end of the scope
}

Name: Anonymous 2010-04-29 12:01

>>120
C already has that, you dumbshit: #undef hello.

And right, if you don't use a constant in a switch it's no more efficient than if.

ITT people who need to learn fucking more about compiler design.

Name: Anonymous 2010-04-29 14:39

>>92,120
As >>120 speculates using constants produces much faster code. I remind myself of this every time I am inconvenienced by it. (The problem isn't so much evaluating a matching expr here or there, it's in eliminating it when it doesn't match--you might as well if-else if- cascade performance-wise. There's also the issue of expression overlap which muddies the notion of a switch, but that's just a nit.)

Name: Anonymous 2010-04-29 15:54

There’s this thing that’s alwasy bothered me… Why in the world do I have to end a struct or enum declaration with a semicolon? The declaration is already enclosed in curly braces, no need for anything more than that.

Name: Anonymous 2010-04-29 15:58

>>123
It's necessary because you can also declare with struct and enum, not just define. Besides that, semicolons terminate statements.

Name: Anonymous 2010-04-29 15:58

The language is fine, but the standard library sucks.

How can there be a FILE* and size_t types? unlink function? Are you kidding?

Why do I need to use an upper–level library just to get some consistency?

Name: Anonymous 2010-04-29 16:19

Make all numbers hexadecimal by default, and digital only if you put 0d in front of them.

Name: Anonymous 2010-04-29 16:48

Make all numbers binary by default, the only other allowable numeric format/representation will be base64

Name: Anonymous 2010-04-29 16:58

>>126
You should try Common Lisp.
You can do this just by setting or binding *read-base*/*print-base* to 16 and maybe *print-radix* to t(only set those that you want. print is for output generated by your application, read is for read input, which also includes the source code which is to be compiled. *print-radix* will allow the base to be included in the output, #x for hexadecimal). I used to try setting them both to 16, but that proved to be a bad idea, some variables got treated as numbers (think of :a,b,c,d,e,f,ab,deadbeef,fade,babe, etc). It's best that hexadecimal numbers be prefixed by something, so that that they don't conflict with normal indentifiers. So currently, I don't rebind/set *read-base* unless I absolutely need it, and I know it would be safe. I do however set *print-base* to 16 and *print-radix* to t, as I prefer numbers to be printed in hex by default.

Name: Anonymous 2010-04-29 17:01

>>126
digital
That's not the word you were looking for.

Name: Anonymous 2010-04-29 17:01

>>126
I like this idea. Well, a little.

Name: Anonymous 2010-04-30 5:10

>>121
I know you can undef, I want scopes so I don't have to have as many damn undefs as my defs.

Name: Anonymous 2010-04-30 5:11

>>131
Oh and I know you can achieve this already by separating files, but sometimes I like having files with more than 1000 lines of code in them.

Name: Anonymous 2010-04-30 5:39

Make all numbers hexadecimal by default, and digital only if you put 0d in front of them.
so numbers would be analog unless they have 0d in front of them?

Name: Anonymous 2010-04-30 8:38

The only thing C needs, really, is native quaternion support.

Name: Anonymous 2010-04-30 9:16

>>134
I also miss unicode support and/or TeX-like markup, so I could name my variables \psi and \lambda and my editor would show them as proper symbols, ideally even storing them in the file as such (i.e. UTF-8 encoded). Without this C just feels slightly antiquated and inadequate for my specific requirements.

Name: Anonymous 2010-04-30 9:36

Little thing with a few example includes I'd like to see:
Also, this is mostly taken from C++ and Python
/********
** ++C **
********/

// Types - string?
//    native comparison
string foo = "FOO!!!"
string bar = "BAR!!!"

if(foo == bar) { //True
   foo[0] = 'B'; // Still accessable as a char array
   printf("%s\n", foo);
}

if(foo < bar) { //False, 'O' > 'A'
   printf("LOL HIGHER\n");
} else if(foo != bar) {
   printf("Example Password: %s DENIED\n", bar);
}


// Types - bool
//    simple single-bit variable
bool example = 0; //1-bit taken
bool exampletable[20] = 0; //20-bits taken

// bool exampletwo = False;
// True and False are not keywords, only ints 0 and 1 for bools


// Single-line comments:
// just because of the useful


// Namespaces:
//  #insert <namespaces.cpp>
namespace lol {
   int epic_lulz;
}

lol::epic_lulz = 2;

using namespace lol;
epic_lulz = 9001;


// OOP
class board {
   init:
      // I like the 'init:' header, but this will
      //  need to be changed in order to work properly
      initclass(int boardCols, int boardRows) {
         int boardX = boardCols;
         int boardY = boardRows;
      }
        
   private: //As C++, but can use vars from init:
      int boardX;
      int boardY;
     
   public: //As C++, but can use vars from init:
      bool board[boardX][boardY];
     
}

class board gol(20, 30);
gol.board[18][2]

Name: Anonymous 2010-04-30 9:39

>>135
IIRC there's nothing in the standard that says that source files can't be UTF-8, and your "TeX-like markup" is an editor misfeature, not part of the language.

Name: Anonymous 2010-04-30 10:49

>>136
Several of these features ruin C for the tasks where it's the most useful.

If you want a high level language, start with Python, Lisp, or Haskell.

Name: Anonymous 2010-04-30 11:09

>>136
Fucking AIDS.

Name: Anonymous 2010-04-30 11:32

>>137
You should read the standard again. Identifiers cannot contain unicode (or backslashes, incidentally).

Name: Anonymous 2010-04-30 11:38

>>140
IDENTIFY MY ANUS

Name: Anonymous 2010-04-30 13:09

>>138
I'd rather start with J.

Name: Anonymous 2010-04-30 13:15

>>136
Improvements you'd like to see for C that are taken from Sepples? GENIUS!

Name: Anonymous 2010-04-30 13:27

- Add integral types of specific sizes int16, int32 etc.
- binary literals e.g. 0b101010

Name: Anonymous 2010-04-30 13:38

add directx to the standard lib so u can use it to make games
make it so u dont have to remember the ; everywhere, when its a new line it should now what i mean lol.

Name: Anonymous 2010-04-30 13:56

>>145
when its a new line it should now what i mean lol.
C99 already added significant whitespace, so it's a small step.

Name: Anonymous 2010-04-30 14:48

>>136
single line comments are already in C99

>>144
integral types of specific sizes are specified in C99's stdint.h
also, not sure why you would need binary literals; hex representation is so much nicer and I can do the conversions in my head

Name: Anonymous 2010-04-30 15:17

>>146
C99 has FIOC? Explain.

Name: Anonymous 2010-04-30 15:54

>>148
Significant whitespace doesn't necessarily mean FIOC. Assuming that >>146 is Xarn, then his complaint is probably // comments

Name: Anonymous 2010-04-30 21:26

>>149
Which everyfuckingcompiler has had as an addition to C syntax nearly forever.

Considering even BCPL had // comments, I'm not sure what the point was of not having them in C in the first place.

Name: Anonymous 2010-05-01 9:04

>144
- typedef some stuff in your global.h
- gcc already added that extension

Name: Anonymous 2010-05-01 12:12

>>151
You don't even need typedefs, just use stdint.h ffs

Name: Anonymous 2011-02-03 0:08

Name: Anonymous 2011-02-04 12:01

Name: Anonymous 2012-02-23 22:42

c would be perfect if it had perl-like hashes.

Name: Anonymous 2012-02-23 23:06

>>156
It doesn't mix very well. Any kind of advanced language construct with an opaque implementation in C gets all fucked up and weird when combined with all the low level weird shit you can do in C. C by itself can be complete and make sense. If you want better features, you can delegate them to a library and use some advanced data types. Then if you want to, maybe introduce some syntactic sugar that would translate to use of the library.

Name: >>157 2012-02-23 23:07

>>156
in short, use C with nice libraries and a nice macro system.

Name: Anonymous 2012-02-23 23:57

s-expressions

Name: Anonymous 2012-02-24 5:06

I agree, c#/.net is bullshit for web (public internet) development, JS+PHP is superior here.
But for Internal networks in companies, c# is pretty good.
Microsoft regularly provides security updates, tech support is important for companies, and C# can provide an easy and secure server-client model. No need for an external HTTP server.
Personally, I only use JS/Jquery/PHP/HTML for my public websites.
Not only because it's the best for it's job, but also because private persons can't really afford a windows server to host a homepage or web services.
And that's because linux, php and JS are free, and they do their job really good.
We conclude: Websites: HTML/JS/PHP, Web Services, Private Networks: May be in C# etc.

Name: Anonymous 2012-02-24 18:50

Some kind of `modules', i.e. something like binary header files. It's present in D am I right?

Name: Anonymous 2012-02-24 19:49

* Prefix notation
* Higher order functions
* Closures
* Lexical scoping
* Garbage collection
* First-class continuations
* Tail-call optimization
* Hygienic macros
* Full numerical tower
* Code as data

Name: Anonymous 2012-02-24 20:07

>>162
Good thing Sexprs aren't on your list, I would have had to rape your little queer anus if you catch my drift.

Name: Anonymous 2012-02-24 20:42

>>162
* Prefix notation
Use GMP or define macros.
* Higher order functions
Already has them. See bsearch, qsort and signal.
* Closures
Use C++ lambdas or a context struct.
* Lexical scoping
Use C++ lambdas.
* Garbage collection
Implementation-dependent. Undefined behavior means that the standard does not state what happens to malloced regions when they are no longer reachable.
* First-class continuations
Use setjmp and longjmp with an implementation that lets you use jmp_bufs at any time after the caller returns.
* Tail-call optimization
Implementation-dependent. Some compilers already do it.
* Hygienic macros
Use nested scopes using do{}while(0), token concatenation, or inline functions.
* Full numerical tower
C has no operator overloading. How does it add bignums? Terrible!
* Code as data
Implementation-dependent. In some cases it's impossible because code and data are in different address spaces and code is execute-only. In other cases, casting a function pointer to a char * could return a string containing the C source of the function, and casting back could compile a string as C code. Those are all possibilities of undefined behavior.

Name: Anonymous 2012-02-24 21:12

>>164
Use C++

No

Name: Anonymous 2012-02-24 21:27

>>1
I would add SEXP-s to allow robust macros, then lambdas and dynamic typing with optional type signatures. Some package management would be nice too - glVertex crud in global namespace looks ugly.

Name: Anonymous 2012-02-24 21:28

>>166
glVertex crud in global namespace looks ugly.
Also, I cant have several versions of GL library running.

Name: Anonymous 2012-02-24 22:45

>>167
You'd have to change the whole library model to be able to do that.

Name: VIPPER 2012-02-25 10:25

>>162
So you want lisp?

Name: Anonymous 2012-02-25 11:27

Most of you guys don't seem to realize what C was created for.  I wouldn't change a single thing about C because it's great for what it's meant to be and do.

Name: Anonymous 2012-02-25 11:34

I'd give the standard library functions Touhou characters names.

Name: Anonymous 2012-02-25 11:41


#define Satori fopen
#define Marisa strcmp
#define Reimu  exit
#define Sanae  malloc
#define Yuyuko free

Name: Anonymous 2012-02-25 11:45

>>172
Is it harder to reach yuyuko than to reach satori

Name: Anonymous 2012-02-25 15:14

>>172
Who are setjmp and longjmp?

Name: Anonymous 2012-02-25 18:04

>>173
Where do you think all those memory leaks come from?

Name: Anonymous 2012-02-25 18:34

>>174
Patchouli and Suwako.

Name: Anonymous 2012-02-25 19:37

LUCK BE A DUBS TONIGHT!

Name: Anonymous 2012-02-25 21:49

Tagged unions.
tagged_union generic_object {
     FILE *file;
     struct {
          size_t len;
          char *buf, *current;
     } buffer;
     int sock;
};
int read_generic(tagged_union generic_object g) {
     switch(g) {
          case file:
          case buffer:
          case sock:
     }
}

If the types are known at compile time, inlining and dead code elimination could allow the functions to be replaced by inline cases and the tags to be removed at compile time. Regular unions which are tagged with an enum or integer aren't as efficient because there's no standard way to associate enum values with union members.

Name: Anonymous 2012-02-25 21:57

C was already changed, its called C++. I use C++ to do C programming because I prefer cin/cout and the string class to C's insane I/O.

C90 is just a cheap copy of C++

Name: Anonymous 2012-02-25 22:07

>>170
C/C++ is great for being shit.

Name: Anonymous 2012-02-25 22:15

http://en.wikipedia.org/wiki/ALGOL_68
I would deprecate C and bring back the ALGOL standardization committee. It's pretty sad when languages from the 60's like Lisp, ALGOL and APL are more advanced and modern than junk languages like Java, PHP and Go. I wonder what 60's scientists and engineers who thought we would be vacationing on Mars and talking to strong AIs in the year 2000 would think about our current state of computing if they arrived in a time machine?

Name: Anonymous 2012-02-25 23:01

>>181
Hmmm, this sounds harsh but I guess it's true.

Name: Anonymous 2012-02-25 23:32

>>181
I wonder what 60's scientists and engineers who thought we would be vacationing on Mars and talking to strong AIs in the year 2000 would think about our current state of computing if they arrived in a time machine?
MacCarthy's last project was Elephant
http://www-formal.stanford.edu/jmc/elephant/elephant.html
Elephant programs themselves can be represented as sentences of logic. Their extensional properties follow from this representation without an intervening theory of programming or anything like Hoare axioms.
which sounds like an interactive version of Wolfram Alpha, where user can input facts himself.

Name: Anonymous 2012-02-26 2:29

>>179
Fuck off Bjarne you're an idiot.

Name: Anonymous 2012-02-26 2:48

C has and always will be a stupid hack to implement an inefficient broken by design OS.

Name: Anonymous 2012-02-26 21:25

>>162
>* Garbage collection

Get a load of this faggot.

Name: Anonymous 2012-02-26 21:30

gc is shit
lisp is shit
therefore gc is lisp

Name: Anonymous 2012-02-26 22:14

>>186
Enjoy your OMG OPTIMIZED "hello, world!" with only 82% memory leaked !!

Name: Anonymous 2012-02-27 0:09

>>186
Yes, it is much better for a program to subtly crash and have memory corruption based exploits than, *gasp* use garbage collection.

Name: Anonymous 2012-02-27 0:19

This thread is fucking fail. C needs:

1. Real string library. Yes, ASCIIZ was a mistake.
2. Expanded standard library. File system abstractions are the big one. Why do we assume all implementations will have files but not folders? struct packing is another problem that is incredibly common and frequently done horribly horribly wrong, but solved with a very simple library.
3. Minor stylistic fixes including non-semicolon terminated labels before end of block, const const cast fixes, remove the untagged nested struct/union bubbling crap, remove the sole register storage class semantic.
4. Better specified sequence point model, in particular synchronizing the order of execution of side-effects between sequence points with the order of evaluation.
5. Consolidation of types. The int, short, long, long long, uint, ushort, ulong, size_t, ptrdiff_t, int, uintn_t, intn_t, intptr_t, int_fastn_t, uint_fastn_t, int_leastn_t, uint_leastn_t, uintptr_t crap is just remarkably stupid. int and char should be implementation defined widths, but it does not make sense for anything else.
6. Better error handling mechanisms. Huge swathes of most large codebases are dedicated to checking return values, the errno crap is incredibly stupid, not thread safe, not even internally consistent. Look at the code for parsing a long in man 3 strtol, and compare with Java catch(NumberFormatException e).
7. Unicode support, wide characters are a fucking plague.

Name: Anonymous 2012-02-27 0:21

We summon the spirits of the computer with out spSegmentation fauSerial Experiments Lain

Name: Anonymous 2012-02-27 0:26

>>190
exceptions are shit.

Name: Anonymous 2012-02-27 1:38

>>190
1. Real string library. Yes, ASCIIZ was a mistake.
Your "real strings" are in C++. Use that instead of turning C into C++.
2. Expanded standard library. File system abstractions are the big one. Why do we assume all implementations will have files but not folders? struct packing is another problem that is incredibly common and frequently done horribly horribly wrong, but solved with a very simple library.
Folders are different in every filesystem. How would a standard way of representing directories work since different OSes and filesystems use '\', '/', '::', ':', and '.' as path separators? How would the files be enumerated in directories? What would it do with a directory called C/C++ standard headers? How would it handle drive letters in Windows or DOS? What about future OSes? <dirent.h> is only useful for POSIX directories. _Alignof and _Alignas were added to C11 for struct packing.
3. Minor stylistic fixes including non-semicolon terminated labels before end of block, const const cast fixes, remove the untagged nested struct/union bubbling crap, remove the sole register storage class semantic.
Why remove register? It's a hint that the address of the object cannot be taken.
4. Better specified sequence point model, in particular synchronizing the order of execution of side-effects between sequence points with the order of evaluation.
C leaves the order of ++/-- and argument evaluation unspecified to make it easier for the compiler to optimize for that machine. If you care about the order, use the comma operator or split it into separate statements. Scheme also leaves the order of argument evaluation undefined.
5. Consolidation of types. The int, short, long, long long, uint, ushort, ulong, size_t, ptrdiff_t, int, uintn_t, intn_t, intptr_t, int_fastn_t, uint_fastn_t, int_leastn_t, uint_leastn_t, uintptr_t crap is just remarkably stupid. int and char should be implementation defined widths, but it does not make sense for anything else.
Not everything uses 8-bit bytes and 32-bit longs. Some Crays use a whole 64 bits for chars because it's faster than using shift and mask. For people who only use MSVC, this doesn't matter, but people who care about portability want to make sure their code still compiles 60 years from now.
6. Better error handling mechanisms. Huge swathes of most large codebases are dedicated to checking return values, the errno crap is incredibly stupid, not thread safe, not even internally consistent. Look at the code for parsing a long in man 3 strtol, and compare with Java catch(NumberFormatException e).
The Linux man pages are full of GNU-style crap which is usually the most compilcated way to write code. errno is thread-safe on all systems with multi-threaded C libraries (even Windows and Linux). If it isn't thread-safe and the OS is, you should file a bug report with the compiler manufacturer (if you're not using a 15-year-old compiler). Again, if you want C++ features like exceptions, use C++.
errno = 0;
val = strtol(str, &endptr, base);
if (errno) {
     /* handle error */
}

7. Unicode support, wide characters are a fucking plague.
Unicode has been added to C11. I checked the date on your post twice to make sure I wasn't responding to a post from 2006.

Name: Anonymous 2012-02-27 3:04

>>193
Your "real strings" are in C++. Use that instead of turning C into C++.
A feature being present in one language does not preclude it being needed in another. Length prefixed strings are not some newfangled high level concept, they are just an alternative to null terminated strings that have proved to be better.
folders bla bla bla
Funny, files are different in every filesystem too, so is the size of a byte, and the basic execution character set. That "but.. but.. portability!" drivel might work on children, but not me sorry.
_Alignof and _Alignas were added to C11 for struct packing.
I haven't read C11 yet, but in any case these aren't sufficient for the primary use case (serialization). You also _Byteorderof, _Bitorderof, _Paddingbyteof, and a whole host of other shit.
Why remove register? It's a hint that the address of the object cannot be taken.
I didn't suggest removing it, reread what I said.
C leaves the order of ++/-- and argument evaluation unspecified to make it easier for the compiler to optimize for that machine.
Irrelevant, reread what I said. In particular that statements like p = p->next = q; are undefined.
Not everything uses 8-bit bytes and 32-bit longs.
Reread what I said. "int and char should be implementation defined widths"
The Linux man pages are full of GNU-style crap
Point is well taken, but it was just an example. Do you care to rebut the point that managing exceptions and return values in C takes an inordinate amount of effort?
If it isn't thread-safe and the OS is
What is an "OS"? Where is that mentioned in the C standard?
Unicode has been added to C11.
I wasn't aware of that, thanks.

Name: Anonymous 2012-02-27 8:14

>>190

1. ASCIIZ still is the best solution for handling strings. It is absolutely overhead-free, which fits well with the rest of the language. One is always free to implement strings in some other way, and it is so simple to implement that even macros can handle the boilerplate. Trying to make strings look as if they were simple data types (as integers) is the real mistake;
2. True. However, I don't understand what you mean by "structure packing is another problem that is solved with a very simple library", care to elaborate? Structure packing is never a problem if one is versed in the standard.
3. Agreed.
4. Agreed.
5. Agreed, though it would be quite hard to solve this problem.
6. Agreed to an extent. Handling errors is -not- simple as people might expect -- error handling should actually be considered part of the business logic itself, and not something "exceptional" (pun intended). Do you have a suggestion on how to make this better? Also, errno is thread-local in systems featuring threads, and the C standard (up to C99) does not know what a "thread" is. I don't know about C11 though. If errno is -not- thread-local in C11, then yes, this is a serious defect.
7. Disagree. C is character encoding-agnostic, and that is Good. Unicode support is cancer.

Name: Anonymous 2012-02-27 10:35

>>193
If you care about the order, use the comma operator or split it into separate statements

That's really not true. Learn the language.

Name: Anonymous 2012-02-27 12:05

A feature being present in one language does not preclude it being needed in another. Length prefixed strings are not some newfangled high level concept, they are just an alternative to null terminated strings that have proved to be better.
struct string {
     size_t length;
     char str[];
};

Funny, files are different in every filesystem too, so is the size of a byte, and the basic execution character set. That "but.. but.. portability!" drivel might work on children, but not me sorry.
A filename in C is a string that references something that can be accessed using fopen. Path separators, drive letters, file versions, and resource fork IDs, if they exist at all, are all part of the string. A file in C doesn't have to have a size and doesn't have to be seekable. All it needs is some way to read and/or write bytes in either text or binary modes (which can be the same). Data written to a file can be reread on the same machine no matter what character set, byte size, or byte order is used by reading and writing the same data types. Data can be read portably on any machine by serializing the bytes with shifts and masking and using a translate table where e.g. table['a'] == 97;. Whether a file is a regular file, device, pipe, symbolic link, memory-mapped data, or any other type, it can always be accessed as a stream of bytes. You can portably open argv[1] if it's a valid filename no matter what filesystem or path separators are in use.
Directories are not simple streams of bytes or lines of text. They contain other items and standardizing directories is useless unless there is a way to list these items. Can directories contain subdirectories? What about symbolic links? Should they be followed? If they are followed, how would a directory that contains a link to itself be handled? What about resource forks? If the file has resource forks, programmers will want to be able to see them. Should these multiple resource forks or data streams be viewed by opening the file as a directory? This won;t work if symbolic links or directories have resource forks separate from their referenced files. Do hidden files begin with a "." or have an attribute? Should there be a way to access hidden files? How do you determine the path separator? What about determining what drive letters are accessible? What about files with multiple versions like in VMS?
POSIX sys/stat.h mentions inodes and group IDs, but doesn't mention hidden attributes, access control lists, alternate data streams or type codes. dirent.h says nothing about them either.
I haven't read C11 yet, but in any case these aren't sufficient for the primary use case (serialization). You also _Byteorderof, _Bitorderof, _Paddingbyteof, and a whole host of other shit.
I agree that there should be some way to improve portably serializing structs. I think C should add functions similar to hton* and ntoh* functions. I would have the "network" side of these functions be an array of unsigned char with a maximum of 255 even if bytes are more than 8 bits. If you read the C11 standard you will find that _Alignas controls padding bytes.
What is an "OS"? Where is that mentioned in the C standard?
"OS" meaning some collection of functions that is included with the system but is not part of the C standard or the compiler's extensions. This "OS" might support threads even if the compiler and C library do not. If the compiler implementer claims to support threads and errno is not thread-safe, you should file a bug report.

Name: Anonymous 2012-02-27 12:10

>>199,200
nice dubs bros

Name: Anonymous 2012-02-27 12:22

>>198
Thanks

Name: Anonymous 2012-02-27 12:22

>>198
bro

Name: Anonymous 2012-02-27 12:42

>>199,200
timestamp dubs

Name: Anonymous 2012-02-27 14:23

>>201
My word, I'm on a roll!

Name: Anonymous 2012-02-27 16:16

>>202
My word, I'm a troll!
Fixed.

Name: Timmy 2012-02-27 17:10

Hey guys.

Name: Anonymous 2012-02-27 22:59

>>204
sup

Name: Anonymous 2012-03-14 17:04

>>197
You seem to think that including support for folders at the language level necessitates fully specifying some kind of standard file system, it doesn't.

They contain other items
Yes, that's the entire fucking point of a folder.
Can directories contain subdirectories?
The API doesn't care, that's for the filesystem to decide.
What about symbolic links?
The API doesn't care, that's for the filesystem to decide.
blah blah blah
As above.

Stop writing bullshit. If it's sensible to assume we have files, it's also sensible to assume we have folders -- you even make my point for me by posing ostensibly rhetorical questions about files yourself! To wit, "Do hidden files begin with a "." or have an attribute?"

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