Похожие чаты

0 - There is no one standard function call for

dynamic memory allocation. If I want to use calloc, I use and want to delete it from your machine, it is your decision.

1 - Tell me what is the difference between this :
char **f = (char **)calloc(1, sizeof(char *));
and this:
char **f = (char **)malloc(1 * sizeof(char *));

2 - You do not read what I wrote. He might want to be sure that all allocated memory starts with zero. Can you guarentee with that malloc? How do you know his requirements? Without req, you cannot say no reason for it.

2 ответов

13 просмотров

This is a simple split function

wait a second, i'm sorry, in first look i did not see that realloc in code so one problem does not exist anymore. so the main problem is just allocating as much as strlen and strcpy() on it which is writing + 1 outside of buffer for null terminator. also these mem allocation functions requires casting to needed type. but still 0- there is no standard because c devs want control. if you want 0 it all for no reason it's your choice, i won't waste resources for your product. 1- that's not the point. calloc is just zeroing one pointer's value in that case. the main zeroing problem starts in loop on zeroing so many unnecessary bytes also dynamically so with many bytes its a continuely hiccup until end. anyway even with few bytes, any issue more than 0 if remain on purpose shows programmer's irresponsibility which is dangerous in unseen parts of the project. if somebody want be sure that all buffers start with 0 (which is not necessary in context of this code) so will zero one first byte of it not all of it. his requirement is pretty clear in this code.

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта