Skip to main content

Questions tagged [standard-library]

Filter by
Sorted by
Tagged with
2 votes
1 answer
177 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,300
0 votes
2 answers
236 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
389 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
2k 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,754
-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.3k
2 votes
1 answer
277 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
207 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
321 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
838 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
575 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,922
0 votes
1 answer
123 views

Who should I submit a bug to when two vendor libraries collide?

I found a bug. Yay for me. The bug is such a mix of technologies I am not sure who I should submit the bug to. The bug is a mix of Adobe Experience Manager and Angular Materials. Neither is really ...
TyMayn's user avatar
  • 133
0 votes
2 answers
191 views

Basing all .NET applications on a central CORE library? [closed]

The company I work for was recently acquired by a much larger company. In conversation with their IT systems group there was some discussion about modifying the existing programs so that they use a '...
John M's user avatar
  • 185
3 votes
1 answer
2k views

Does Java's Object.wait() really achieve nanosecond accuracy?

I was checking out the Java 8 standard library source code just out of curiosity, and found this in java/lang/Object.java. There are three methods named wait: public final native void wait(long ...
sampathsris's user avatar
2 votes
3 answers
1k views

Is there a stricter strtoull() in any ubiquitous C library?

I want a function that will interpret a string as a strictly unsigned integer, failing when the string overflows, represents a negative number, or does not represent a number. strtoull() does set ...
ShadSterling's user avatar
57 votes
5 answers
14k views

Why do all <algorithm> functions take only ranges, not containers?

There are many useful functions in <algorithm>, but all of them operate on "sequences" - pairs of iterators. E.g., if I have a container and like to run std::accumulate on it, I need to write: ...
lethal-guitar's user avatar
17 votes
3 answers
2k views

Why isn't there a typeclass for functions?

In a learning problem I've been messing around with, I realised I needed a typeclass for functions with operations for applying, composing etc. Reasons... It can be convenient to treat a ...
user avatar
3 votes
2 answers
3k views

Languages with graph data structures and algorithms in standard library

I am trying to improve my knowledge and ability with graphs and graph algorithms and have noticed something curious: as far as I can tell no "mainstream" language contains support for graphs in its ...
Evicatos's user avatar
  • 672
1 vote
1 answer
2k views

Performance overhead of standard containers and boost [closed]

Adap.TV has chosen C++ to develop their software. However, they've decided not to use the standard containers1 and boost for performance reasons, as they've blogged about it in the following article: ...
Sarfaraz Nawaz's user avatar
10 votes
4 answers
3k views

What language should I use for making a cross platform library? [closed]

I want to build a SyncML parsing library (no UI) which should be able to build up messages based on information provided by the host application, fed in by the library's methods. Also, the library ...
Alex's user avatar
  • 587