Git Product home page Git Product logo

bjarnestroustrup / programming-_principles_and_practice_using_cpp Goto Github PK

View Code? Open in Web Editor NEW
395.0 395.0 120.0 22.99 MB

This repository houses the header files available from http://www.stroustrup.com/Programming/PPP2code for use while learning C++ from Bjarne Stroustrup's book 'Programming: Principles and Practice Using C++ (Second Edition).'

Home Page: http://www.stroustrup.com/Programming/

C++ 28.66% C 71.34%

programming-_principles_and_practice_using_cpp's People

Contributors

randomdsdevel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

programming-_principles_and_practice_using_cpp's Issues

Resolving Code Origin, Attribution, and Access Permissions

@BjarneStroustrup:

N. b.: This issue is a fork of discussion started in #1 meant to prompt resolution of some issues described and/or encountered throughout the course of its history. Additionally, references to 'the original author' or similar statements refer to @BjarneStroustrup. Similarly, references to 'a third party' or similar statements refer to myself, @RandomDSdevel.


Problem Statement

     As initially mentioned here, the resolution of #1 of this repository's issues has led to the creation of a range of additional problems. To summarize, they are as follows:

  • Due to some unforeseen (if not accidental…?) events in its history (described further below in this bullet item's second sub–bullet item for the sake of preserving historical accuracy,) the code stored in this repository:
    • Lacks proper attribution to its original author, particularly within the relevant commit history.
    • Retains misleading, distracting, and/or superfluous commit artifacts over and above those those involving actual code modification and/or maintenance which originate from and are related only to a third party's efforts to upload a copy of the original codebase downloaded from its original home on the original author's personal web site to GitHub in order to improve its overall visibility and reusability.
  • The third party has, due to a mistake on the part of this code's original author, become one of this repository's maintainers in a manner not supported by GitHub. (Specifically:
    • The former's GitHub account has been granted what one might interpret as root-/maintainer-level access to at least this repository, if not the entirety of the original author's GitHub account, thereby entangling the permissions of the former user's GitHub account with those of the latter in a wholly unsupported fashion.)

Suggested Resolution(s)

     The third party submitting this issue recommends that this repository's contents' original author consider adopting the second of the two alternative resolutions proposed below if the commit manipulation involved in adopting the first of them becomes too arduous. Otherwise, the former individual suggests that this repository's contents' original author assess the logistical plausibility of adopting that first alternative resolution. The referenced alternative resolutions follow directly below.

Alternative One

  1. Have this repository's contents' original author revoke the involved third party's accidentally gained maintainer privileges, thereby disassociating their two accounts and clarifying to GitHub that this repository is not jointly owned by both individuals. Consequently, performing this operation would also:
    A. Remove this upstream repository from the list of repositories that GitHub recognizes as owned by the third party.
    B. Revoke the third party's access to internal details of this repository's contents' original author's GitHub account to which the former should most definitely not have access.
  2. Have the repository's contents' original author rework this repository's commit history to:
    A. Squash all of the commits currently comprising it into a single commit.
    B. Reattribute the resulting commit to himself. (Note that he could also change the author listed in at least one of the currently existing commit's commit messages before squashing them if he so chose.)
  3. Have the repository's contents' original author return to allowing third parties, including the one mentioned within this issue, to contribute to this repository by either and/or both of the following methods:
    A. Creating a GitHub organization and transferring this repository's ownership to it, then giving responsible individuals' accounts membership in it, thus granting them the permissions and rights associated with the role(s) which it would grant these accounts.*
    B. Allowing non-maintainers to submit pull requests for maintainers to merge into the repository at their discretion.

Alternative Two

  1. Have this repository's contents' original author perform step 1 as listed under 'Alternative One' above.
  2. Have this repository's contents' original author delete this repository altogether, thus ensuring complete and utter removal of any artifacts that might inadvertently remain within GitHub's user and repository databases after he performed step 1 of this alternative, and reconstruct a fresh duplicate of it from his original codebase under either his own user account or a new GitHub organization as recommended in the third step listed under 'Alternative One' above.
  3. Have this repository's contents' original author perform step 3 as listed under 'Alternative One' above.

Footnote

*Please note that the third party submitting this issue does not consider this a well-advised direction for his future involvement in this project's evolution, if any, due to his lack of programming experience.

Transfer of Ownership

@BjarneStroustrup:

Per (and quoted directly from) the 'GitHub Repository for 'Programming: Principles and Practice Using C++' Support Code?' thread's original post on the ISO C++ std-discussion reflector from when I tried to reach you concerning the subject a while back:

Dear Mr. Stroustrup,

     I think it would very convenient and useful if you were to put the support code that you have published on your web page for Programming: Principles and Practice Using C++. Doing so would allow users like myself to be more proactive in suggesting and contributing improvements and code errata. For example, end users have previously contributed build support for additional compilers. I, myself, have created a GitHub repository containing the support code for the second edition of the book and, even though I haven’t yet gotten around to doing it, plan to add better support for Xcode, either directly via an Xcode template or indirectly through a CMake build profile. It would be nice if there were a central version of such a repository for me to submit my changes to with a pull request. A central location for the support files might also allow me to port my efforts back to the code for the book’s first edition as well. Could you, perhaps, look into setting this up for your readers?

Sincerely,
     Bryce Glover
     [email protected]

P. S.: Yes, I know I should have gotten my contributions ready to merge by now, but I got distracted/derailed…oh, well; such is life (mine especially, it seems these days…sigh.)

Case sensitive files are colliding

Hi Bjarne,

when cloning your repo on windows, git says:

warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'GUI.h'
  'Gui.h'

Can you fix this? Would be pretty useful ;)

Have a nice day!

fltk.h [Error] FL/Fl.H: No such file or directory

I can not run this core without following file. How can i do it

#ifndef FLTK_GUARD
#define FLTK_GUARD 1

#include "FL/Fl.H"
#include "FL/Fl_Window.H"
#include "FL/Fl_Button.H"
#include "FL/Fl_Input.H"
#include "FL/Fl_Output.H"
#include // for exit(0)
#include "FL/fl_draw.H"
#include "FL/Enumerations.H"

#include "Fl/Fl_JPEG_Image.H"
#include "Fl/Fl_GIF_Image.H"

#endif

Vector[ ] range check: Tautological compare

If I include std_lib_facilities.h, I get:

$ clang++ FirstStepsInCPP.cpp -std=c++14
In file included from FirstStepsInCPP.cpp:4:
./book_headers/std_lib_facilities.h:107:8: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                if (i<0||size()<=i) throw Range_error(i);
                    ~^~
./book_headers/std_lib_facilities.h:113:8: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                if (i<0||size()<=i) throw Range_error(i);
                    ~^~
2 warnings generated.

Which is absolutely true; i is an unsigned int so why bother checking for negative values?

C++ DataFrame

@BjarneStroustrup ,

I hope all is well …
I have developed the C++ DataFrame (https://github.com/hosseinmoein/DataFrame) a data analysis library, similar to Pandas or Polars, in the past 7 years in my spare times. It has reached a stage that it is being used around the world mostly in financial systems but also in other scientific fields too. My main objective was to enrich the C++ ecosystem because I believe it lacks behind other languages such is Python, Java.
I wanted to bring this to your attention in case you have time and interest to critique it.

Best,
Hossein Moein

J

K

Is there any particular reason that I am not able to run the a program using std_lib_facilities.h?

System : Debian, Ubuntu 18.10, clion-2018.1.2

Source code :

#include "std_lib_facilities.h"
int main(){
    cout<<"Hello world\n";
}

CMakeLists.txt :

cmake_minimum_required(VERSION 3.10)
project(ppu_cpp)

set(CMAKE_CXX_STANDARD 11)

add_executable(ppu_cpp main.cpp std_lib_facilities.h)

Error :


/home/abhi/Desktop/clion-2018.1.2/bin/cmake/bin/cmake --build /home/abhi/Desktop/ppu-cpp/cmake-build-debug --target ppu_cpp -- -j 2
[ 50%] Building CXX object CMakeFiles/ppu_cpp.dir/main.cpp.o
In file included from /usr/include/c++/7/ext/hash_map:60:0,
                 from /home/abhi/Desktop/ppu-cpp/std_lib_facilities.h:34,
                 from /home/abhi/Desktop/ppu-cpp/main.cpp:1:
/usr/include/c++/7/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
 #warning \
  ^~~~~~~
In file included from /usr/include/c++/7/locale:41:0,
                 from /usr/include/c++/7/iomanip:43,
                 from /home/abhi/Desktop/ppu-cpp/std_lib_facilities.h:212,
                 from /home/abhi/Desktop/ppu-cpp/main.cpp:1:
/usr/include/c++/7/bits/locale_facets_nonio.h:1971:5: error: template-id 'do_get<>' for 'String std::__cxx11::messages<char>::do_get(std::messages_base::catalog, int, int, const String&) const' does not match any template declaration
     messages<char>::do_get(catalog, int, int, const string&) const;
     ^~~~~~~~~~~~~~
/usr/include/c++/7/bits/locale_facets_nonio.h:1971:62: note: saw 1 'template<>', need 2 for specializing a member function template
     messages<char>::do_get(catalog, int, int, const string&) const;
                                                              ^~~~~
CMakeFiles/ppu_cpp.dir/build.make:62: recipe for target 'CMakeFiles/ppu_cpp.dir/main.cpp.o' failed
make[3]: *** [CMakeFiles/ppu_cpp.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ppu_cpp.dir/all' failed
make[2]: *** [CMakeFiles/ppu_cpp.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/ppu_cpp.dir/rule' failed
make[1]: *** [CMakeFiles/ppu_cpp.dir/rule] Error 2
Makefile:118: recipe for target 'ppu_cpp' failed
make: *** [ppu_cpp] Error 2

What are pointers in C++?

I can’t understand at all why pointers were created if all objects from the heap are passed by reference?

Not so random randint

I tried using randint to make a number guessing game, but it suspiciously always selected 1. The problem is the lack of seed:

  static random_device r;
  static default_random_engine ran(r());

Is what you need.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.