>>60291476
Because either constantly reallocating your array or scattering the contents all over memory is such a good idea. Much efficienct wow.
>>60291476
>what is malloc
You fucking scrub
>Pascal
>dynamically sized array
Yeah, no. Several Object Pascal dialects have something that looks like a dynamic array, but is actually just a pointer in disguise that's reallocated as needed and freed at the end of a procedure. Also all the modern 8-bit and unicode string types are heap-based with automatical reference counting.
http://wiki.freepascal.org/Dynamic_array
http://wiki.freepascal.org/Character_and_string_types#AnsiString
The pure Pascal way uses either arrays with fixed size baked into their type signature or pointers (including pointer arithmetic) just like C.
>>60291498
>*autistic screeching*
>>60291856
muh cache misses
You can easily implement a dynamic array in C with about 10 minutes if you're not retarded. And at least that way you know the cost of it.
>>60291476
>>60291476
If you aren't working with fixed size data structures, you might have to think about what data structures you actually need to use to get a decent representation and decent performance.
>>60291872
Don't be such a baby.
All applications run on 60 megs of xeon L2
What the fuck? People still use Pascal?
I learned that shit back in high school 15 years ago.
>>60291985
What the fuck? People still use C?
I learned that shit back in high school 40 years ago.
>>60291996
I don't recall Pascal being used industry-wide...
>>60291476
>Catering to undergrads
And that's how we get code monkeys
>>60291806
Came here to point this exact thing out, fuck you OP.
>>60291476
>what is malloc
>what is realloc
>>60292094
That's why you use superior C++ instead of C
#include <stdio.h>
int five_star_add(int *****a, int *****b)
{
return *****a + *****b;
}
int main(void) {
int a = 5;
int b = 2;
int *ap = &a;
int **app = ≈
int ***appp = &app;
int ****apppp = &appp;
int *bp = &b;
int **bpp = &bp;
int ***bppp = &bpp;
int ****bpppp = &bppp;
printf("%d\n", five_star_add(&apppp, &bpppp));
return 0;
}
>>60292190
>*autistic screeching*
>>60292190
Post a function pointer one.
>>60291875
>10 minutes
wew
>>60292190
This is literally autistic screeching
What operating system are you posting this thread on OP?
>>60292508
BlackPantherOS
>>60292508
Windows
>>60291498
>>60291511
C makes assumptions that my OS follows a memory model from the 1960s
var foo = 'reee';
console.log(foo + (foo.slice(1).repeat(50));
>>60292587
>repeat
D has this too
>>60292585
memory layout hasn't changed since then
>>60292595
>repeat
E has this too
>>60292606
>he uses a commodity architecture
>>60292094
>What is an ADT
>>60292649
something that doesn't solve the problem
>>60292681
if ADT's aren't a solution C is the problem
ain't even the best choice for embedded systems anymore (VHDL/ASICs)
they even give you a valid license.
>tfw I can't program my PIC with rust
I would use Rust if they were serious about it being a systems language
>>60292771
Because nobody uses it. They can't even give it away lol XD XD
>>60292508
macOS Sierra <3
>>60292784
>using modern delphi
>>60291875
*with almost 100% chance of exposing buffer overflow or dangling pointer vulnerabilities
Man, C is truly shit
>>60291476
I'd like to see how nicely your dynamic array resizing holds up in a kernel, especially an interrupt handler. Faggot.
>>60292585
And it'd still be correct today, because your OS still follows that same model.
>>60293452
Doesn't happen in my code.
Maybe you just suck at programming?
>>60293532
>>60292606
Not the quoted, but I think the meant that memory capacity at the 60s was generally so low that you absolutely HAD to micromanage so you could get max performance.
Pascal didn't allow this.
>>60291806
The entire dynamic array thing falls apart as soon as you try to copy it, since it's just a pointer.
Also C has realloc, isn't that what OP wants?
>>60293594
>>>/pajeet/
>>60293594
Memory capacity might not be an issue any more but efficient memory usage is absolutely important. As processors get faster and memory stays slow, efficient cache usage and memory locality are increasingly important for performant computing.
>>60291476
pascal has real array, real string.
C just has pointers
And pascal was invented before C.
WTF?
>>60293715
no, OP doesn't want anything other than shitposting
>>60295258
>implying strings aren't backed by more pointers
>>60291875
But apparently, nobody does it the right way, judging from 99.99999999% of all C repositories.
>>60293557
That's a lie. You write bugs.
You just deluded yourself into ignorance.
>>60292712
>ain't even the best choice for embedded systems anymore (VHDL/ASICs)
It is truly incredible how close to the peak of mount stupid you are.
>>60291476
you do realize that when you dynamically size an array in python/whatever, it's doing the same thing you do in C under the hood?
ITT bad programmers blame a language because they failed their data structures course
>>60291476
there is no such thing as a dynamically sized array
>>60295258
You should go back to Logic class
>>60295345
>implying strings aren't backed by more pointers
in discussions of C vs other languages people often confuse types and implementation. you can obviously implement anything in C, and for the most part "modern languages" aren't doing anything else different in implementation.
C types, however, are very inexpressive, and in professional C you end up writing a lot of text macros to overcome this; i'm sure everyone has seen something like#DEFINE_DYNAMIC_ARRAY_TYPE(int)
the main difference between that and std::vector<int> is that the language and compiler isn't cognizant of the macro, so it can't e.g. check whether the int type actually satisfies the requirements of vector (e.g. movable/copyable for resize). so you turn a compile-time error into a runtime error, which is a concrete problem
>>60291476
if an array is dynamically sized can it even be called an array?
>>60291476
> what is malloc
>>60295865
>in professional C you end up writing a lot of text macros to overcome this; i'm sure everyone has seen something like
>#DEFINE_DYNAMIC_ARRAY_TYPE(int)
What exactly does this mean?
>>60295738
thuis