• Re: Why is Usenet dead?

    From Mr Flibble@leigh@i42.co.uk to comp.lang.c++ on Thu Feb 20 17:39:44 2025
    From Newsgroup: comp.lang.c++

    On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Wed, 19 Feb 2025 19:15:18 +0200
    Michael S <already5chosen@yahoo.com> wibbled:
    On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
    Reimplementing double-linked list is fine if all you need is
    double-linked list. It does not take more than 20 minutes and typically
    you end up with code that fits requirements better than when you
    take it from somebody else.

    Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >where to start if asked to do it. As for them implementing a dynamic array >using realloc(), pffft , forget it. Not that I'd bother now of course.

    You cannot implement std::vector in terms of realloc().

    /Flibble
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Paavo Helde@eesnimi@osa.pri.ee to comp.lang.c++ on Thu Feb 20 22:39:31 2025
    From Newsgroup: comp.lang.c++

    On 20.02.2025 19:39, Mr Flibble wrote:
    On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Wed, 19 Feb 2025 19:15:18 +0200
    Michael S <already5chosen@yahoo.com> wibbled:
    On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
    Reimplementing double-linked list is fine if all you need is
    double-linked list. It does not take more than 20 minutes and typically
    you end up with code that fits requirements better than when you
    take it from somebody else.

    Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >> where to start if asked to do it. As for them implementing a dynamic array >> using realloc(), pffft , forget it. Not that I'd bother now of course.

    You cannot implement std::vector in terms of realloc().

    You can, for trivially relocatable types, which means most of the C++
    value types even if they have non-trivial ctors and dtors. There is a
    C++26 proposal for formalizing that concept (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html).

    Not sure if using specifically realloc would be a good idea though, I
    guess with current trends of massive multithreading and fixed size
    allocation pools there probably is no benefit in using realloc over an explicit malloc+memcpy.
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Muttley@Muttley@DastardlyHQ.org to comp.lang.c++ on Fri Feb 21 10:23:44 2025
    From Newsgroup: comp.lang.c++

    On Thu, 20 Feb 2025 17:39:44 +0000
    Mr Flibble <leigh@i42.co.uk> wibbled:
    On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Wed, 19 Feb 2025 19:15:18 +0200
    Michael S <already5chosen@yahoo.com> wibbled:
    On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
    Reimplementing double-linked list is fine if all you need is >>>double-linked list. It does not take more than 20 minutes and typically >>>you end up with code that fits requirements better than when you
    take it from somebody else.

    Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>where to start if asked to do it. As for them implementing a dynamic array >>using realloc(), pffft , forget it. Not that I'd bother now of course.

    You cannot implement std::vector in terms of realloc().

    Sure youy can , its just an allocator that attempts to extend currently allocated memory. Its absolutely what you'd use in a vector type for operations like push_back though obviously its not the whole solution.

    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Muttley@Muttley@DastardlyHQ.org to comp.lang.c++ on Fri Feb 21 10:24:55 2025
    From Newsgroup: comp.lang.c++

    On Thu, 20 Feb 2025 22:39:31 +0200
    Paavo Helde <eesnimi@osa.pri.ee> wibbled:
    On 20.02.2025 19:39, Mr Flibble wrote:
    On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Wed, 19 Feb 2025 19:15:18 +0200
    Michael S <already5chosen@yahoo.com> wibbled:
    On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
    Reimplementing double-linked list is fine if all you need is
    double-linked list. It does not take more than 20 minutes and typically >>>> you end up with code that fits requirements better than when you
    take it from somebody else.

    Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>> where to start if asked to do it. As for them implementing a dynamic array >>> using realloc(), pffft , forget it. Not that I'd bother now of course.

    You cannot implement std::vector in terms of realloc().

    You can, for trivially relocatable types, which means most of the C++
    value types even if they have non-trivial ctors and dtors. There is a
    C++26 proposal for formalizing that concept >(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html).

    Not sure if using specifically realloc would be a good idea though, I
    guess with current trends of massive multithreading and fixed size >allocation pools there probably is no benefit in using realloc over an >explicit malloc+memcpy.

    Even if on some kernel setup realloc() is no better, it still keeps your
    code cleaner while being obvious to a maintenance coder what you're doing.

    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Mr Flibble@leigh@i42.co.uk to comp.lang.c++ on Fri Feb 21 12:12:28 2025
    From Newsgroup: comp.lang.c++

    On Fri, 21 Feb 2025 10:23:44 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Thu, 20 Feb 2025 17:39:44 +0000
    Mr Flibble <leigh@i42.co.uk> wibbled:
    On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Wed, 19 Feb 2025 19:15:18 +0200
    Michael S <already5chosen@yahoo.com> wibbled:
    On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
    Reimplementing double-linked list is fine if all you need is >>>>double-linked list. It does not take more than 20 minutes and typically >>>>you end up with code that fits requirements better than when you
    take it from somebody else.

    Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>>where to start if asked to do it. As for them implementing a dynamic array >>>using realloc(), pffft , forget it. Not that I'd bother now of course.

    You cannot implement std::vector in terms of realloc().

    Sure youy can , its just an allocator that attempts to extend currently >allocated memory. Its absolutely what you'd use in a vector type for operations
    like push_back though obviously its not the whole solution.

    No you cannot.

    /Flibble
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Mr Flibble@leigh@i42.co.uk to comp.lang.c++ on Fri Feb 21 12:13:48 2025
    From Newsgroup: comp.lang.c++

    On Thu, 20 Feb 2025 22:39:31 +0200, Paavo Helde <eesnimi@osa.pri.ee>
    wrote:

    On 20.02.2025 19:39, Mr Flibble wrote:
    On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Wed, 19 Feb 2025 19:15:18 +0200
    Michael S <already5chosen@yahoo.com> wibbled:
    On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
    Reimplementing double-linked list is fine if all you need is
    double-linked list. It does not take more than 20 minutes and typically >>>> you end up with code that fits requirements better than when you
    take it from somebody else.

    Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>> where to start if asked to do it. As for them implementing a dynamic array >>> using realloc(), pffft , forget it. Not that I'd bother now of course.

    You cannot implement std::vector in terms of realloc().

    You can, for trivially relocatable types, which means most of the C++
    value types even if they have non-trivial ctors and dtors. There is a
    C++26 proposal for formalizing that concept >(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html).

    Not sure if using specifically realloc would be a good idea though, I
    guess with current trends of massive multithreading and fixed size >allocation pools there probably is no benefit in using realloc over an >explicit malloc+memcpy.

    std::vector value_type can be non-relocatable type ergo you cannot
    implement std::vector in terms of realloc for all types ergo you
    cannot implement std::vector in terms of realloc.

    /Flibble
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Muttley@Muttley@DastardlyHQ.org to comp.lang.c++ on Fri Feb 21 12:25:02 2025
    From Newsgroup: comp.lang.c++

    On Fri, 21 Feb 2025 12:13:48 +0000
    Mr Flibble <leigh@i42.co.uk> wibbled:
    On Thu, 20 Feb 2025 22:39:31 +0200, Paavo Helde <eesnimi@osa.pri.ee>
    wrote:

    On 20.02.2025 19:39, Mr Flibble wrote:
    On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
    wrote:

    On Wed, 19 Feb 2025 19:15:18 +0200
    Michael S <already5chosen@yahoo.com> wibbled:
    On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
    Reimplementing double-linked list is fine if all you need is
    double-linked list. It does not take more than 20 minutes and typically >>>>> you end up with code that fits requirements better than when you
    take it from somebody else.

    Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know

    where to start if asked to do it. As for them implementing a dynamic array >>>> using realloc(), pffft , forget it. Not that I'd bother now of course.

    You cannot implement std::vector in terms of realloc().

    You can, for trivially relocatable types, which means most of the C++ >>value types even if they have non-trivial ctors and dtors. There is a >>C++26 proposal for formalizing that concept >>(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html).

    Not sure if using specifically realloc would be a good idea though, I >>guess with current trends of massive multithreading and fixed size >>allocation pools there probably is no benefit in using realloc over an >>explicit malloc+memcpy.

    std::vector value_type can be non-relocatable type ergo you cannot
    implement std::vector in terms of realloc for all types ergo you
    cannot implement std::vector in terms of realloc.

    I very much doubt that the allocation code in vector is one size fits all,
    that would be a ridiculous way to implement it.

    --- Synchronet 3.20c-Linux NewsLink 1.2