CS undergrads will understand

...

Other urls found in this thread:

wiki.freepascal.org/Dynamic_array
wiki.freepascal.org/Character_and_string_types#AnsiString
twitter.com/AnonBabble

Because either constantly reallocating your array or scattering the contents all over memory is such a good idea. Much efficienct wow.

>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.
wiki.freepascal.org/Dynamic_array
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.

>*autistic screeching*

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.

...

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.

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.

What the fuck? People still use C?

I learned that shit back in high school 40 years ago.

I don't recall Pascal being used industry-wide...

>Catering to undergrads
And that's how we get code monkeys

Came here to point this exact thing out, fuck you OP.

...

>what is malloc
>what is realloc

...

That's why you use superior C++ instead of C

#include

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;
}

>*autistic screeching*

Post a function pointer one.

>10 minutes
wew

This is literally autistic screeching

What operating system are you posting this thread on OP?

BlackPantherOS

Windows

C makes assumptions that my OS follows a memory model from the 1960s

var foo = 'reee';
console.log(foo + (foo.slice(1).repeat(50));

>repeat
D has this too

memory layout hasn't changed since then

>repeat
E has this too

>he uses a commodity architecture

>What is an ADT

something that doesn't solve the problem

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

Because nobody uses it. They can't even give it away lol XD XD

macOS Sierra

>using modern delphi

*with almost 100% chance of exposing buffer overflow or dangling pointer vulnerabilities

Man, C is truly shit

I'd like to see how nicely your dynamic array resizing holds up in a kernel, especially an interrupt handler. Faggot.

And it'd still be correct today, because your OS still follows that same model.

Doesn't happen in my code.
Maybe you just suck at programming?

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.

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?

>>>/pajeet/

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.

pascal has real array, real string.
C just has pointers

And pascal was invented before C.

WTF?

no, OP doesn't want anything other than shitposting

>implying strings aren't backed by more pointers

But apparently, nobody does it the right way, judging from 99.99999999% of all C repositories.

That's a lie. You write bugs.
You just deluded yourself into ignorance.

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

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

there is no such thing as a dynamically sized array

You should go back to Logic class

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

if an array is dynamically sized can it even be called an array?

> what is malloc

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

thuis