C/C++ standard libraries

Asked

Viewed 313 times

4

What’s the downside of using libraries standards such as the function getch() and the library conio.h, What is the downside of using such libraries from a development point of view? More precisely in the case of C-programming on micro processors, web or even software.

I have a bad practice of using libraries standards and I don’t know what implications it causes in my code.

1 answer

4


One important thing is that you won’t be able to use it on other compilers and platforms as few implement it. One of the things that people don’t understand that language is something much more than the compiler they installed on their machine, that the fact that it works on their machine doesn’t mean that it will work anywhere.

Of course, she can even use it if she’s sure that code won’t be used in another situation, that is, knowing what she’s doing can all be done. The problem is that one uses it unknowingly, learns wrong and gets used to it. Although I shouldn’t worry too much because it is common that people who do this will not continue programming in C or C++, she is exercising a little out of obligation or taste, but when she starts having a lot of difficulties she will give up the language and go on something easier, the ones who will not give up are usually the ones who can understand all the concepts of what they are doing and look for a way to learn structure.

So there are people who say programming in C when they program in Borland C which is a dialect of the C language. Only those that conform 100% to the standard are pure C.

And that’s usually a bigger problem because it’s usually available in legacy compilers or that it only keeps that for compatibility, and it’s common for these libraries to have security issues, whether it’s by specific implementation, or even by the concept (has several standard C functions that should not be used for this reason).

This question of good or bad practice has to do with this thing of not knowing why things, you can use it if you know why you’re doing it, and do something that works, but you don’t know why, you shouldn’t do it. In addition to the general reasons, each library has some specific reason not to be used.

In general, using C libraries when programming in C++ is not very suitable and can bring some difficulties. By the way, this is another bad thing that people believe by knowing everything superficially, C++ is a completely different language than C, but people think it’s not because it can compile almost any C code.

The last sentence of the first paragraph doesn’t seem to make much sense.

What is a programming language, IDE and compiler?.

  • Since more I want to thank you for your answer, what I wanted to say is that I am studying Eng.Eletrotecnica, more in the area of micro processors and I would like to know the influence you have in not using standard libraries, because if we compile will create a file . exe, on which any pc can run.

  • 1

    Every computer has microprocessor, you’ve talked about software, and everything you do in a programming language is software, and spoke web, if it is backend it doesn’t matter if it’s frontend you will not be using C or C++. PC is not the only type of computer that exists, and speaking of electronics you may want to talk about microcontroller, which is far from PC. And usually these devices use off-standard C, programming for them is often very different from programming for PC.

  • So in a microcontroller you can already use all kinds of libraries? Or is it a very different way of programming where you don’t have to import these kinds of libraries? I have not yet started to study this part of microcontrollers and so I do not know what awaits me in terms of programming in this regard.

  • 1

    No, exactly the opposite, one can only use the libraries that exist for it, which are often not even the standards, the compiler used in microcontrollers are often not of standard C, is u dialect of it. It’s not enough to be totally different, but there are fundamental differences. And there are exceptions where the pattern is used. But still the way of programming can be different because of the limitation of that hardware or the requirement of exception, often needs to be a hard real time.

  • Finally, if you have any articles that you recommend to read on this subject, thank you very much. Thank you very much!

  • 1

    Nothing specific.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.