Wheels-Of-Fire

Forum Replies Created

Viewing 20 posts - 241 through 260 (of 1,996 total)
  • Author
    Posts
  • in reply to: C++ Programming #63396
    Wheels-Of-FireWheels-Of-Fire
    Participant
      @grahamdearsley
      Forumite Points: 4

      Here we go again.

      I am well used to using subscripting to obtain a substring from a container, it is more or less the same as Atari BASIC except that with BASIC you supply a starting element and an ending element but with C++ you supply a starting element and a length. However, now I am being told to avoid subscripting if I can because it is not guaranteed to be safe, it is possible to supply a substring that goes off the ends of a container.

      C++ provides a pair of iterators for container types called .begin and .end

      When a container is first created .begin will point to the first element and .end will point to 1 past the last. These are iterators so they can be incremented or decremented  to get the previous or next element but neither of them can be set to point to outside a container. The .end iterator cannot be set to point to before .begin and .begin cannot be set to point to after .end so they are safe.

      You can also dereference an iterator to get the value of the element it points to.

      I am still reading about iterators because there is more to them but at the moment it just seems like more complication 🙄

      in reply to: C++ Programming #63380
      Wheels-Of-FireWheels-Of-Fire
      Participant
        @grahamdearsley
        Forumite Points: 4

        Another advantage to preallocating enough space is that if you only ever add elements to the end using <push_back> then any pointers or references you have to existing elements will not be invalidated by having them moved around in memory. If you insert an element somewhere in the middle then any pointers or references after the insertion point will still become invalid.

        in reply to: C++ Programming #63378
        Wheels-Of-FireWheels-Of-Fire
        Participant
          @grahamdearsley
          Forumite Points: 4

          Just found another couple of interesting member functions that apply to library container classes.

          As I have mentioned before, all the container types, except Array, can be expanded at will and, as their elements have to be contiguous in memory, if you expand a container then all its elements need to be moved to a new, larger, block of memory. You can’t just tack a new element on the end of the existing elements because that memory may well be in use buy something else.

          Except sometimes you can 😁.

          As I have mentioned before, when you first create a container, like a Vector or String, C++ only allocates enough memory to hold its initial list of elements, after all you may never expand the container. After you expand a container once, and its elements need to be moved, C++ will allocate a new memory block that is bigger than required for the new element, how much bigger is implementation dependent but it gives some spare capacity so the elements will not need to be moved again when you next add an element. This is where the member functions I just read about come in handy.

          The <capacity> function returns the number of elements you can add before they will all need to be moved again.

          The <reserve> function allows you to allocate extra space in advance, so if you know how big your container is likely to get then you can allocate that much space in advance and save all the copying time.

          The <shrink_to_fit> function does what it says on the tin, it deallocates unused space.

          None of the above is necessary for your program to work but it may well make it faster.

           

          in reply to: 2021 The Year of New Android Phones/Pads #63337
          Wheels-Of-FireWheels-Of-Fire
          Participant
            @grahamdearsley
            Forumite Points: 4

            Its not really as bad as it sounds. Only about 30% of existing websites will be affected and only those that wan’t to loose the custom of the large installed base of older android devices will not provide alternative signing arrangements before september next year.

            in reply to: Xmas Gaming PC #63313
            Wheels-Of-FireWheels-Of-Fire
            Participant
              @grahamdearsley
              Forumite Points: 4

              Hmm. Just been on the Palicomp website.

              Started with their £699 Intel gaming PC and then speced it up to what I would LIKE for a high’ish end gaming PC.

              Result = £1713 !

              in reply to: Xmas Gaming PC #63286
              Wheels-Of-FireWheels-Of-Fire
              Participant
                @grahamdearsley
                Forumite Points: 4

                Oh and you should get an NVMe connected SSD if your budget will stretch to it 😃

                in reply to: Xmas Gaming PC #63284
                Wheels-Of-FireWheels-Of-Fire
                Participant
                  @grahamdearsley
                  Forumite Points: 4

                  If you still wan’t to spec a desktop  PC for yourself, but don’t want the bother of building it, then I would suggest you visit the website of someone like Palicomp or Scan PC.  Select the parts you like from their PC configuration sections and it will give you a running total on the price. You will also get a years guarantee and support on the delivered computer.

                  For what you are asking I would go for something like an Intel Core i5 or a midrange AMD Razen with at least 8GB of RAM and a 500GB SSD, some would suggest more memory but I have never found a need for it.

                  The graphics card is entirely down to the depth of your pocket but I would not rely on built in graphics for even casual gaming.

                  in reply to: Will the Political Establishment seek revenge on Trump? #63268
                  Wheels-Of-FireWheels-Of-Fire
                  Participant
                    @grahamdearsley
                    Forumite Points: 4

                    Well you were out of luck there Ed, the choice was Trump or Biden 😆

                    in reply to: Will the Political Establishment seek revenge on Trump? #63258
                    Wheels-Of-FireWheels-Of-Fire
                    Participant
                      @grahamdearsley
                      Forumite Points: 4

                      I really don’t see why the people of this country are still so interested in the US elections. In the immediate post war years we were hugely reliant on the US of A but now we are not. About the only thing we depend on now is their involvement with NATO and if the EU get their way it won’t exist for much longer anyway.

                      When was the last time you brought something with made in the USA stamped on it ? About the only things we export to the US are luxury cars and other things with a high “Britishness” value and they will keep buying those things whatever happens.

                      The so called richest country in the world is actually the one with the most massive debt and the interest on that is rising by the second. After a few more years of Democrat spending I can’t see them ever paying that back.

                      So whats the big fuss about US elections ?

                      in reply to: C++ Programming #63193
                      Wheels-Of-FireWheels-Of-Fire
                      Participant
                        @grahamdearsley
                        Forumite Points: 4

                        Hmm. If you want to get REALLY close to the metal with VC++ then have a look at the link below.

                        https://docs.microsoft.com/en-us/cpp/assembler/inline/inline-assembler-overview?view=msvc-160

                        Just found that while I was looking for something else, as is usual when looking for anything in the Visual Studio Doc’s 🤨

                        in reply to: RTX3090’s X4 #63167
                        Wheels-Of-FireWheels-Of-Fire
                        Participant
                          @grahamdearsley
                          Forumite Points: 4

                          My Gigibyte X58 mobo came X4 SLI certified and it has 4 16x slots that can supply 8 PCIe 2 lanes each.

                          I would be interested to know if the 4 card setup setup they tested would work, so if someone could just send me 4x RTX 3090 cards ?

                          🤣😂🤣

                          in reply to: RTX3090’s X4 #63165
                          Wheels-Of-FireWheels-Of-Fire
                          Participant
                            @grahamdearsley
                            Forumite Points: 4

                            At least the power draw of a 2400W supply wouldn’t be a problem in this country. 240/30V x 13A = ~3000W.

                            I built my current i7/X58 PC with an i7 930 and a single Radeon HD5770, I then brought a HD5750 by mistake but as it had the same amount of memory and was also a 5000 series I decided to give it a go as the second card in X Fireconfiguration anyway.

                            To my surprise, the scores in most benchmarks more or less doubled.In the benchmarks where the score didn’t double it hardly changed at all, meaning they were not taking advantage of X Fire.

                            The system stayed like that until I got a single RX480 and the score doubled again on ALL benchmarks 😃

                            in reply to: C++ Programming #63162
                            Wheels-Of-FireWheels-Of-Fire
                            Participant
                              @grahamdearsley
                              Forumite Points: 4

                              Visual Studio C++/CLI is indeed used to generate managed code for the .NET framework and it does use intermediate code.

                              But I am NOT using it 😆

                              C++/CLI is a seperate component provided with Visual Studio. I am using Visual C++, also provided with VS,and it produces neat, standalone, executable, binary’s, straight from source code.

                              As it happens VC++ also includes a C complier that is now C99 compliant so you can use that instead if you like.

                              in reply to: C++ Programming #63157
                              Wheels-Of-FireWheels-Of-Fire
                              Participant
                                @grahamdearsley
                                Forumite Points: 4

                                I have found something else I don’t like about the C++ Primer book but its not really a fault.

                                Up until now I have been typing in the examples and code snippets to gain practice with the syntax but they are getting a bit long now so I decided to go to the books website and download the sample code from there.

                                The problem I have is that, like every other C++ book I know of, they are determined to be as standards compliant and device independent as possible which means that they mostly concentrate on using the ISO compliant GCC Compiler kit. This Compiler is command line only and the code examples assume you will be using a command line compiler.

                                There are separate downloads for Linux with GCC and for Visual Studio, pre and post VS12 but they assume you will be using the Visual C++ command line.

                                The code samples are divided into chapters but all the .cpp and .h files are in the same folder along with a MAKE file and its template. If you use the NMAKE.EXE Utility from the command prompt then it will use the Make file to build seperate .EXE files for all the sample code, supposedly, but I am using the GUI, NOT the command prompt.

                                In the GUI there is an option to create a new project from existing source files, you give it the path to your source files and a name for your new project and hit OK, job done, all set for compilation. The trouble is that the source code for all the examples in a chapter is in the same folder so the build project wizard tries to include ALL of them in the new project. The result is not useful !

                                To make things work I have to make new folders for each code sample and copy only the files it needs into it. This is not quite as easy as it sounds because different .cpp files require different .h files and some of them share the same one. I either have to go through the source code to see what #include’s there are or just try a compile to see what errors come up.

                                This is just a niggle but they could have made life much simpler by putting the code in separate folders in the first place, each with its own Make file if they wanted.

                                in reply to: USB type C #63031
                                Wheels-Of-FireWheels-Of-Fire
                                Participant
                                  @grahamdearsley
                                  Forumite Points: 4

                                  I have said this before but the Windows front end you see is really just a subsystem running on top of the NT Kernel. NT handles the file systems,virtual memory, multitasking and multiuser features, and infact everything else. The Windows subsystem can do very little without making a syscall into NT

                                  in reply to: USB type C #63027
                                  Wheels-Of-FireWheels-Of-Fire
                                  Participant
                                    @grahamdearsley
                                    Forumite Points: 4

                                    I’m not sure why anyone wouldn’t prefer Windows these days. DOS was rubbish and Windows 9x had many faults but Windows 10 is based on the NT kernel and it is a whole different animal. Rewritten from the ground up by the man who designed the DEC VMS OS.

                                    in reply to: C++ Programming #63009
                                    Wheels-Of-FireWheels-Of-Fire
                                    Participant
                                      @grahamdearsley
                                      Forumite Points: 4

                                      And the bloody compiler is always right,if a member is private then it IS 😆

                                      in reply to: C++ Programming #63007
                                      Wheels-Of-FireWheels-Of-Fire
                                      Participant
                                        @grahamdearsley
                                        Forumite Points: 4

                                        Been doing a bit more Re-reading and it turns out that in C++ a struct  is almost exactly the same as a class. The ONLY difference is that class members are private by default and struct members are public but you can change that by inserting public or private in your class or struct definition.

                                         

                                        in reply to: USB type C #62964
                                        Wheels-Of-FireWheels-Of-Fire
                                        Participant
                                          @grahamdearsley
                                          Forumite Points: 4

                                          Well if you like JCD. Thing is though, we are getting far too much tier 3 at the moment, from all directions, much more tier 1 would be nice 😃

                                          in reply to: USB type C #62956
                                          Wheels-Of-FireWheels-Of-Fire
                                          Participant
                                            @grahamdearsley
                                            Forumite Points: 4

                                            Get yourself a powered USB-C Hub. It SUOULD Pass through all USB functions but given the complexity of the Standard, Who knows ?

                                             

                                          Viewing 20 posts - 241 through 260 (of 1,996 total)