Questions tagged [standard-library]

The standard library contains core utilities provided by all implementations of the language.

The standard library contains core utilities provided by all implementations of the language.

The size and scope of the standard library varies between languages, some provide only a few basic components for such things as string handling and I/O, whereas others provide higher-level tools for a wide variety of tasks such as XML processing, networking and database access.

For questions about specific languages' standard libraries use this tag in conjunction with the tag for the language, or use the indicated tags for these languages:

677 questions
74
votes
3 answers

Template Specialization VS Function Overloading

A textbook I have notes that you can provide your own implementation for standard library functions like swap(x,y) via template specialization or function overloading. This would be useful for any types which can benefit from something other than…
John Humphreys
  • 37,047
  • 37
  • 155
  • 255
69
votes
2 answers

What is the opposite of python's ord() function?

I found out about Python's ord() function which returns corresponding Unicode codepoint value. But what is the opposite function, i.e. get char value by int? Edit: I'm new to SO, and couldn't find the answer here, so decided to post in order to…
dkol
  • 1,421
  • 1
  • 11
  • 19
69
votes
5 answers

What is GLIBC? What is it used for?

I was searching for the source code of the C standard libraries. What I mean with it is, for example, how are cos, abs, printf, scanf, fopen, and all the other standard C functions written, I mean to see their source code. So while searching for…
user1261015
66
votes
2 answers

Why do some built-in Python functions only have pass?

I wanted to see how a math.py function was implemented, but when I opened the file in PyCharm I found that all the functions are empty and there is a simple pass. For example: def ceil(x): # real signature unknown; restored from __doc__ """ …
edgarstack
  • 1,096
  • 1
  • 10
  • 18
64
votes
5 answers

Are int8_t and uint8_t intended to be char types?

Given this C++11 program, should I expect to see a number or a letter? Or not make expectations? #include #include int main() { int8_t i = 65; std::cout << i; } Does the standard specify whether this type can or will…
Drew Dormann
  • 59,987
  • 13
  • 123
  • 180
61
votes
8 answers

Subclass/inherit standard containers?

I often read this statements on Stack Overflow. Personally, I don't find any problem with this, unless I am using it in a polymorphic way; i.e. where I have to use virtual destructor. If I want to extend/add the functionality of a standard container…
iammilind
  • 68,093
  • 33
  • 169
  • 336
60
votes
7 answers

Why is Haskell missing "obvious" Typeclasses

Consider the Object-Oriented Languages: Most people coming from an object-oriented programming background, are familiar with the common and intuitive interfaces in various languages that capture the essence of Java's Collection & List interfaces.…
recursion.ninja
  • 5,377
  • 7
  • 46
  • 78
58
votes
7 answers

How can I tell if a Perl module is core or part of the standard install?

How can I check if a Perl module is part of the core - i.e. it is part of the standard installation? I'm looking for: a command-line command: a Perl subroutine/function to check within code Perhaps the question should be: How can I tell what…
therobyouknow
  • 6,604
  • 13
  • 56
  • 73
57
votes
14 answers

Which functions in the C standard library commonly encourage bad practice?

This is inspired by this question and the comments on one particular answer in that I learnt that strncpy is not a very safe string handling function in C and that it pads zeros, until it reaches n, something I was unaware of. Specifically, to quote…
user257111
55
votes
16 answers

Most useful Python modules from the standard library?

I am teaching a graduate level Python class at the University of Paris, and the students need to be introduced to the standard library. I want to discuss with them about some of the most important standard modules. What modules do you think are…
Eric O. Lebigot
  • 91,433
  • 48
  • 218
  • 260
54
votes
7 answers

How to flatten a list to a list without coercion?

I am trying to achieve the functionality similar to unlist, with the exception that types are not coerced to a vector, but the list with preserved types is returned instead. For instance: flatten(list(NA, list("TRUE", list(FALSE), 0L)) should…
eold
  • 5,972
  • 11
  • 56
  • 75
54
votes
3 answers

What does the "c" mean in cout, cin, cerr and clog?

What does the "c" mean in the cout, cin, cerr and clog names? I would say char but I haven't found anything to confirm it.
Rexxar
  • 1,886
  • 1
  • 14
  • 19
51
votes
1 answer

Embed Python3 without standard library

EDIT: I have asked an opposing question here: How to embed Python3 with the standard library A solution for Python2 is provided here: Is it possible to embed python without the standard library? However, Python3 fails on Py_Initialize(); with: Fatal…
P i
  • 29,020
  • 36
  • 159
  • 267
51
votes
4 answers

When is #include library required in C++?

According to this reference for operator new: Global dynamic storage operator functions are special in the standard library: All three versions of operator new are declared in the global namespace, not in the std namespace. The first and second…
Paul Caheny
  • 1,281
  • 3
  • 11
  • 16
51
votes
3 answers

Does std::mt19937 require warmup?

I've read that many pseudo-random number generators require many samples in ordered to be "warmed up". Is that the case when using std::random_device to seed std::mt19937, or can we expect that it's ready after construction? The code in…
Brent
  • 4,153
  • 4
  • 30
  • 63
1
2
3
45 46