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

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-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?

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