|
AlsoD posted:actually wait no, because i work in a immutable language it's most strings in c are immutable, in the sense that trying to mutate them results in an mpu exception and a core dump also, in your language where most datatypes are immutable, you've got copy-on-write behind the scenes when you actually have to have a text buffer or whatever rather than a static string. one can reasonably argue that making this mostly transparent to the user is beneficial, but it isn't completely trivial; the distinction between value equality and reference equality still exists somewhere and comes up in at least some contexts
|
# ? Jul 25, 2014 15:06 |
|
|
# ? May 27, 2024 03:25 |
|
lol i'm a lowly php dev and i immediately knew what (*s++ = *t++) meant. lol at elitist c people who pretend pointers are this huge intractable mystery and not a simple but hacky concept that should rarely be used
|
# ? Jul 25, 2014 15:30 |
|
Tiny Bug Child posted:a simple but hacky concept that should rarely be used haha what
|
# ? Jul 25, 2014 15:41 |
|
pointers. they're not hard to understand, it's just that there's almost always a better way to do something than use pointers.
|
# ? Jul 25, 2014 15:52 |
|
Mr. Glass posted:haha what c and pointers are garbage
|
# ? Jul 25, 2014 16:15 |
|
Tiny Bug Child posted:lol i'm a lowly php dev and i immediately knew what (*s++ = *t++) meant. lol at elitist c people who pretend pointers are this huge intractable mystery and not a simple but hacky concept that should rarely be used you're really suggesting that people who are C experts actually thing pointers are an "intractable mystery"? ahahahahah
|
# ? Jul 25, 2014 16:18 |
|
i'm a C expert but this concept of pointing.. at memory... eludes me
|
# ? Jul 25, 2014 16:18 |
|
instead of copying this 500kb struct around i am going to take its address and "point" at it ugh what a disgusting hack
|
# ? Jul 25, 2014 16:22 |
|
Mr Dog posted:treating arrays interchangeably with pointers to their first element is rather obtuse. i mean yeah it makes a lot of sense once you realise the array :2bongs: BOUNDARIES ONLY EXIST IN YOUR HEAD, MAAAAAAAAN :2bongs: but yeah it's really obtuse. unfortunately arrays are not necessarily 100% interchangeable with pointers, they are a separate type arrays are pointers except when they're not. and the exceptions change if you pass an array to a function
|
# ? Jul 25, 2014 16:22 |
|
vapid cutlery posted:you're really suggesting that people who are C experts actually thing pointers are an "intractable mystery"? ahahahahah of course not you dingus. obviously they know there's nothing to it, they just treat it like a huge deal to scare off real devs
|
# ? Jul 25, 2014 16:28 |
|
Mr. Glass posted:instead of copying this 500kb struct around i am going to take its address and "point" at it real languages automatically use pass by reference so programmers don't have to worry about it.
|
# ? Jul 25, 2014 16:29 |
|
Tiny Bug Child posted:of course not you dingus. obviously they know there's nothing to it, they just treat it like a huge deal to scare off real devs that is completely false. it's uninformed morons like you who hype it up
|
# ? Jul 25, 2014 16:29 |
|
the "exceptions" don't "change", rather an array passed as an argument to a function decays to a pointer to its first element. this simple topic is covered in the comp.lang.c faq clearly and accurately so it's distressing to see people repeating gibberish and hoodoo about it twenty years on
|
# ? Jul 25, 2014 16:31 |
|
Tiny Bug Child posted:real languages automatically use pass by reference so programmers don't have to worry about it. nah, actually they pass references by value.
|
# ? Jul 25, 2014 16:31 |
|
Tiny Bug Child posted:real languages automatically use pass by reference so programmers don't have to worry about it. ahahahaha i just can't with this
|
# ? Jul 25, 2014 16:32 |
|
vapid cutlery posted:nah, actually they pass references by value. oh cool time to debate what "pass by reference" means
|
# ? Jul 25, 2014 16:38 |
|
time to debate what goatse means.
|
# ? Jul 25, 2014 16:39 |
|
I think it means "frog golf"
|
# ? Jul 25, 2014 16:40 |
|
Suspicious Dish posted:oh cool time to debate what "pass by reference" means pass by reference means if you give a function a thing it can change the thing and the change is visible outside the scope of that function.
|
# ? Jul 25, 2014 16:40 |
|
Mr Dog posted:So what you're saying is that pointers per se aren't hard, it's just that C's syntax for pointers is terrible (and it also permits wankery like the above). I would say that if only the notion of pointers wasn't so prevalently related with how C deals with it someone earlier in the thread said that assembly makes pointers easier to understand and I feel that she's right but I'm not sure if it's just because I'm used to C pointers now pointer homeworks are nothing to diss
|
# ? Jul 25, 2014 16:42 |
|
Pointers aren't confusing, but the myriad of custom memory layouts are, with crazy arithmetic and dynamic allocation. And they don't get less and less confusing as time goes on. It's what makes an old C codebase feel like an old C codebase. If your only pointers to the head of a struct, then that's a lot easier of a model to teach. And from there, you can expand how you can point to specific fields in the struct, and then go into the rest of the model.
|
# ? Jul 25, 2014 16:50 |
|
Suspicious Dish posted:Pointers aren't confusing, but the myriad of custom memory layouts are, with crazy arithmetic and dynamic allocation. And they don't get less and less confusing as time goes on. It's what makes an old C codebase feel like an old C codebase. if you cant handle indirection you are a bad computer scientist and programmer the essence of cs is indirection via abstraction and vice versa
|
# ? Jul 25, 2014 16:58 |
|
Suspicious Dish posted:If your only pointers to the head of a struct, then that's a lot easier of a model to teach. And from there, you can expand how you can point to specific fields in the struct, and then go into the rest of the model. I actually think C makes for a good beginners language, because it's one of the few that doesn't conflate the notion of pointer with the notion of struct although it conflates pointers and arrays.
|
# ? Jul 25, 2014 17:03 |
|
c looks like a good first language if you consider computation to be something that's done by computers
|
# ? Jul 25, 2014 17:05 |
|
Malcolm XML posted:if you cant handle indirection you are a bad computer scientist and programmer I still find systems that are over-abstracted and have too much indirection. That's the issue with a lot of "enterprise" systems -- they're too scared of sitting down and writing if (business_condition) in the code that they come up with a crazy rules systems. Look at the many "configurable" FizzBuzz tests and rules engines and all that. Too many macros is what kills Lisp. You build such a framework in your own language that it's hard to teach and hard to debug. A bit of indirection is OK. But these are also new students. You need to ramp it up over time. Show them the basics first.
|
# ? Jul 25, 2014 17:09 |
|
Suspicious Dish posted:oh cool time to debate what "pass by reference" means Is a debate where uninformed people give their opinions on a factual topic?
|
# ? Jul 25, 2014 17:16 |
|
ppl getting tbc'ed pretty hard itt
|
# ? Jul 25, 2014 17:38 |
|
Tiny Bug Child posted:real languages automatically use pass by reference so programmers don't have to worry about it. perl
|
# ? Jul 25, 2014 18:11 |
|
Otto Skorzeny posted:the "exceptions" don't "change", rather an array passed as an argument to a function decays to a pointer to its first element. this simple topic is covered in the comp.lang.c faq clearly and accurately so it's distressing to see people repeating gibberish and hoodoo about it twenty years on this means the exceptions to normal pointer behavior are different between an array i declare myself and an array passed to me as an argument it's not gibberish or hoodoo, it's just a stupid and pointless inconsistency
|
# ? Jul 25, 2014 18:50 |
|
the words you just said are gibberish and hoodoo; your fuzzy understanding of the subject is probably due to years of neglect from java
|
# ? Jul 25, 2014 18:54 |
|
Otto Skorzeny posted:the words you just said are gibberish and hoodoo; your fuzzy understanding of the subject is probably due to years of neglect from java my understanding isn't fuzzy. I know exactly how this works because I have to remember these stupid details. It's just loving stupid. C code:
code:
|
# ? Jul 25, 2014 19:19 |
|
the fact that the difference between an array type and a normal pointer is in the comp.lang.c FAQ should be an indicator that people ask about it.
|
# ? Jul 25, 2014 19:23 |
|
the only exception you need to remember is that [] indicates a pointer, and not an array when it appears in the parameter list. it's not an array that's decayed to a pointer, it's just a pointer.
|
# ? Jul 25, 2014 19:24 |
|
arrays wouldnt decay to pointers if bjarne had just shown them the light of references a little earlier
|
# ? Jul 25, 2014 19:28 |
|
that's not an "exception" to anything - it's arguable that the deceptive function signature "int decay(char[])" shouldn't be legal, but the semantics are pretty clear and obvious. as for when the array type is useful, consider the case where you want to initialize a buffer with a string literal but have it be writeable later.
|
# ? Jul 25, 2014 19:28 |
|
Tiny Bug Child posted:php: a simple but hacky concept that should rarely be used
|
# ? Jul 25, 2014 20:48 |
|
I sit near the HHVM people who have been working on the PHP language specification we're about to publish. I don't know how they're ever sober enough to focus their eyes. They just radiate despair.
|
# ? Jul 25, 2014 21:08 |
|
lol
|
# ? Jul 25, 2014 21:13 |
|
Subjunctive posted:I sit near the HHVM people who have been working on the PHP language specification we're about to publish. I don't know how they're ever sober enough to focus their eyes. They just radiate despair. i assume this is because PHPNG is going to render HHVM completely obsolete (and usher in a new era of widespread PHP usage now that its one downside, poor performance, is a thing of the past)
|
# ? Jul 25, 2014 21:19 |
|
|
# ? May 27, 2024 03:25 |
|
It's a PHP language specification. It has nothing to do with PHPNH nor HHVM.
|
# ? Jul 25, 2014 21:21 |