Skip to main content

Questions tagged [standard-library]

2 votes
1 answer
222 views

Why is std::dynamic_extent not zero in c++?

For context, I'm trying to make a span type that has a size type parameter, which mimics much of the std::span api. std::dynamic_extent is not zero in C++, instead being defined as -1ull or std::...
Krupip's user avatar
  • 1,347
0 votes
2 answers
357 views

Appropriate design pattern for providing a default Argparse instance, eliminating boilerplate

I'm using argparse.ArgumentParser extensively; however, it comes with a lot of boilerplate to set up, and this is especially noticeable when you've got more than a few common arguments that probably ...
g_elef's user avatar
  • 19
-1 votes
2 answers
575 views

what algorithm does the malloc function in the c language standard library use? And why it so fast?

Based on the data structure of the AVL tree, I implemented a memory manager that does the best matching according to the size. I originally thought that the speed would be fast and the length of the ...
CukiPid's user avatar
  • 11
6 votes
5 answers
3k views

What was the original purpose of C strncpy() function?

C standard library has strncpy function, declared as: char *strncpy(char *dest, const char *src, size_t n); It's a strange beast, as it fills n bytes of memory pointed to by dest. It does this by ...
hyde's user avatar
  • 3,804
-3 votes
2 answers
2k views

What is the benefit of Java collection streams over C# or Scala collections?

Java collection streams were introduced in Java 8, which came out in March of 2014. By that time, we already had well-established mechanisms for manipulating collections in several other languages, ...
Mike Nakis's user avatar
  • 32.8k
2 votes
1 answer
301 views

Why did C++11 add find_if() instead of overloading find()?

Why did c++11 add a separate find_if() instead of simply overloading the existing find()? Wouldn't overloading the function be sufficient?
Jankovsky144's user avatar
0 votes
1 answer
247 views

Common methods for swapping out a library

I am trying to come up with a solution to replace joda-time with java 8 time in our product. The code-base encompasses many projects of which some import joda-time directly and some transitively. To ...
Kratt's user avatar
  • 11
32 votes
10 answers
9k views

Why are standard libraries not programming language primitives? [closed]

I was thinking why are there (in all programming languages I have learned, such as C++, Java, Python) standard libraries like stdlib, instead of having similar "functions" being a primitive of the ...
user avatar
2 votes
1 answer
3k views

How to optimize reusing a large std::unordered_map as a temporary in a frequently called function?

Simplified question with a working example: I want to reuse a std::unordered_map (let's call it umap) multiple times, similar to the following dummy code (which does not do anything meaningful). How ...
Abaris's user avatar
  • 31
2 votes
2 answers
6k views

Why do we have to include multiple header files for a single library (the C standard library)?

I am not sure why there are so many header file for the C standard library (stdio.h, stdlib.h, math.h). How do these header files point to the same library? I guess I am a little bit confused about ...
yoyo_fun's user avatar
  • 2,297
3 votes
2 answers
340 views

Why does Java's getSystemResourceAsStream silently consume IOExceptions?

While trying to debug a weird issue where I knew an exception should have been thrown but was not, I found the following in the Java standard library's java.lang.ClassLoader class: /** * Open for ...
Ellie Harper's user avatar
3 votes
1 answer
2k views

When was STL formally introduced into C++ standard?

I fail to infer the exact point of historical introduction of STL into actual C++ standard library from the wikipedia article: https://en.wikipedia.org/wiki/Standard_Template_Library It appears to me ...
Loves Probability's user avatar
3 votes
4 answers
871 views

Equivalent of C library functions

In C, almost everything requires a function. What nags me is that I don't know exactly what's going on. If there was no msvcrt.dll file, my C programs would all break because that's where all the ...
Garhoogin's user avatar
-1 votes
1 answer
683 views

Should there be print statements in a library

I have built a library that is being used by a few people. They say that library has a few print statements which is wrong because a library should give freedom to users to use the library the way ...
Gaurav Kumar's user avatar
8 votes
3 answers
10k views

Why would an interface override methods of the interface(s) it extends in Java 7?

I was looking at Map and SortedMap documentation from Java 7 and I have realized that SortedMap, which extends Map overrides entrySet(), keySet() and values(). AFAIK, interfaces cannot implement a ...
Utku's user avatar
  • 1,912

15 30 50 per page