Is C++ a good choice to make bots?

It's almost the same setup, but reversed - you use windows as host and Linux in WSL.

You get bare metal power in Linux and it's accessible by just typing "wsl" in powershell.
 
I think c++ is a bad choice for this task. C++ is better for clienside applications if its about speed/performance etc. I would choose for bots python. U will be much more productive because in python u dont need to care about pointers, memory and stuff.

No. C++ is better choice. You don't have to care about pointers, memory in Modern C++ and that's what I said all along.

Please don't mistake C as C++. You have to do these things in C not in C++ because C++ has abstractions built in.

You don't have to manage memory manually because Modern C++ has RAII. When a thing goes out of scope, the memory automatically released.

if you see a C++ code in a book or tutorial using any of following,

using namespace std; int *p = new int[10]

Just run away and find a different book or tutorial. These things considered as bad C++.

Of course, you can use pointers too but Modern C++ is against this. We have smart pointers (easy to use but rarely need).

Modern C++ has a concept called references. It's an easy concept but you can always pass by value (which creates a copy).
 
Last edited:
Python works best for Linux systems? Hmmm... ok mate.

It's and it always been. I have to use wired tricks, lot of googling to get Python to run in Windows or else you have to use WSL.

C++ works cross platform. In C++, You don't run into issues like Pip or any bullshit like GIL.

git clone your-damn-lib
#include <your-damn-lib>
use

Easy peasy

In C++, you also get access to disk-backed data structures and in other languages you have to use external database or streaming.

Disk-backed data structures gives you ability to use your Hard-drive as RAM.
 
don't listen to all of this suggestions just go learn go (golang) it's performant concurrent language made by google as fast as C/C++ and not really as hard as c++ that's ur best bet !
 
It's and it always been. I have to use wired tricks, lot of googling to get Python to run in Windows or else you have to use WSL.

C++ works cross platform. In C++, You don't run into issues like Pip or any bullshit like GIL.

git clone your-damn-lib
#include <your-damn-lib>
use

Easy peasy

In C++, you also get access to disk-backed data structures and in other languages you have to use external database or streaming.

Disk-backed data structures gives you ability to use your Hard-drive as RAM.
Right I thought you were talking about Linux specifically, not Unix systems.

Also, I think there would be a bunch of devs that code Python on Windows that would disagree.

I've coded Python on Mac and Linux and I prefer Mac, but for many other things Linux is better.
 
don't listen to all of this suggestions just go learn go (golang) it's performant concurrent language made by google as fast as C/C++ and not really as hard as c++ that's ur best bet !

Why do you say don't listen to people and go learn GoLang?

This is the main reason why I dislike hype oriented programming languages.

They destroy democracy and fuel hate. C++ suffer from hate, done by monsters like Linus.

Linus hated High level abstractions, and OOP. He loved raw level assembly.

Golang suffer from GC-latency. It doesn't scale. It's hard to read, it's hard to maintain.

if you are talking about 10 lines then it's easy to read but you will see true colors of GoLang once you exceed 100 lines.

So, what Golang offer is green threads/fibers/coroutines (same thing in three buzz words)

C++ has all these, but I highly recommend std::future and std::async over green threads/fibers/coroutines because they offers you Javascript-style promise style concurrency.

Here an example of green threads/fibers/coroutines on C++,

Code:
#include <iostream>
#include "marl/defer.h"
#include "marl/event.h"
#include "marl/scheduler.h"
#include "marl/waitgroup.h"

int main() {
  // Create a marl scheduler using all the logical processors available to the process.
  // Bind this scheduler to the main thread so we can call marl::schedule()
  marl::Scheduler scheduler(marl::Scheduler::Config::allCores());
  scheduler.bind();
  defer(scheduler.unbind());  // Automatically unbind before returning.

  constexpr int numTasks = 10;

  // Create an event that is manually reset.
  marl::Event sayHello(marl::Event::Mode::Manual);

  // Create a WaitGroup with an initial count of numTasks.
  marl::WaitGroup saidHello(numTasks);

  // Schedule some tasks to run asynchronously.
  for (int i = 0; i < numTasks; i++) {
    // Each task will run on one of the 4 worker threads.

    // Lambda
    marl::schedule([=] {  // All marl primitives are capture-by-value.
      // Decrement the WaitGroup counter when the task has finished.
      defer(saidHello.done());

      std::cout << "Task " << i << " waiting to say hello... << "\n"

      // Blocking in a task?
      // The scheduler will find something else for this thread to do.
      sayHello.wait();

      std::cout << "Hello from task" << i << "\n";
    });
  }

  sayHello.signal();  // Unblock all the tasks.

  saidHello.wait();  // Wait for all tasks to complete.

  // All tasks are guaranteed to complete before the scheduler is destructed.
}
 
Last edited:
Why do you say don't listen to people and go learn GoLang?

This is the main reason why I dislike hype oriented programming languages.

They destroy democracy and fuel hate. C++ suffer from hate, done by monsters like Linus.

Linus hated High level abstractions, and OOP. He loved raw level assembly.

Golang suffer from GC-latency. It doesn't scale. It's hard to read, it's hard to maintain.

if you are talking about 10 lines then it's easy to read but you will see true colors of GoLang once you exceed 100 lines.

So, what Golang offer is green threads/fibers/coroutines (same thing in three buzz words)

C++ has all these, but I highly recommend std::future and std::async over green threads/fibers/coroutines because they offers you Javascript-style promise style concurrency.

Here an example of green threads/fibers/coroutines on C++,

Code:
#include <iostream>
#include "marl/defer.h"
#include "marl/event.h"
#include "marl/scheduler.h"
#include "marl/waitgroup.h"

int main() {
  // Create a marl scheduler using all the logical processors available to the process.
  // Bind this scheduler to the main thread so we can call marl::schedule()
  marl::Scheduler scheduler(marl::Scheduler::Config::allCores());
  scheduler.bind();
  defer(scheduler.unbind());  // Automatically unbind before returning.

  constexpr int numTasks = 10;

  // Create an event that is manually reset.
  marl::Event sayHello(marl::Event::Mode::Manual);

  // Create a WaitGroup with an initial count of numTasks.
  marl::WaitGroup saidHello(numTasks);

  // Schedule some tasks to run asynchronously.
  for (int i = 0; i < numTasks; i++) {
    // Each task will run on one of the 4 worker threads.

    // Lambda
    marl::schedule([=] {  // All marl primitives are capture-by-value.
      // Decrement the WaitGroup counter when the task has finished.
      defer(saidHello.done());

      std::cout << "Task " << i << " waiting to say hello... << "\n"

      // Blocking in a task?
      // The scheduler will find something else for this thread to do.
      sayHello.wait();

      std::cout << "Hello from task" << i << "\n";
    });
  }

  sayHello.signal();  // Unblock all the tasks.

  saidHello.wait();  // Wait for all tasks to complete.

  // All tasks are guaranteed to complete before the scheduler is destructed.
}
but he's asking for some bot programming that would be far easier with golang than c++ , yes golang is fairly hard to read in a big code base but there's alot of frameworks to help you with scalability if am planning to create a simple bot to automate some stuffs i'll chose golang with goroutines and concurrency over c++ if am planning to work in some big cooperation and write code 9-5 with a team i'll chose c++ since it's far more easy to scale and maintain it in the long run
 
Hell no. Take a look at a GET request in C++ vs Python:

C++:
Code:
#include <curl/curl.h>
#include <string>

size_t writeFunction(void *ptr, size_t size, size_t nmemb, std::string* data) {
    data->append((char*) ptr, size * nmemb);
    return size * nmemb;
}

int main(int argc, char** argv) {
    auto curl = curl_easy_init();
    if (curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "https://api.github.com/repos/whoshuu/cpr/contributors?anon=true&key=value");
        curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
        curl_easy_setopt(curl, CURLOPT_USERPWD, "user:pass");
        curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/7.42.0");
        curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
        curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
      
        std::string response_string;
        std::string header_string;
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeFunction);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_string);
        curl_easy_setopt(curl, CURLOPT_HEADERDATA, &header_string);
      
        char* url;
        long response_code;
        double elapsed;
        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
        curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &elapsed);
        curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
      
        curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        curl = NULL;
    }
}

Python:

Code:
import requests

if __name__ == '__main__':
    requests.get('https://google.com')
I know this is an old thread, but I think I should add something to your reply. Please consider the speed implications of using python if you are going to make a large project. Yes, python is pretty minimal; but it sure has problems. It has problem with loops, threading and whatnot. It's slow asf for some use cases (could be as simple as a while loop.. try benchmarking it in c++ vs python). That said, for making a bot in 10 minutes; nothing can beat python.

Just my two cents, use the correct tool for the job.
 
but he's asking for some bot programming that would be far easier with golang than c++ , yes golang is fairly hard to read in a big code base but there's alot of frameworks to help you with scalability if am planning to create a simple bot to automate some stuffs i'll chose golang with goroutines and concurrency over c++ if am planning to work in some big cooperation and write code 9-5 with a team i'll chose c++ since it's far more easy to scale and maintain it in the long run

C++ is easier.

For example, here how you can spawn a headless browser from C++ and control it from C++

Code
https://source.chromium.org/chromium/chromium/src/+/master:headless/app/headless_example.cc
Instructions
https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md


I know this is an old thread, but I think I should add something to your reply. Please consider the speed implications of using python if you are going to make a large project. Yes, python is pretty minimal; but it sure has problems. It has problem with loops, threading and whatnot. It's slow asf for some use cases (could be as simple as a while loop.. try benchmarking it in c++ vs python). That said, for making a bot in 10 minutes; nothing can beat python.

Just my two cents, use the correct tool for the job.

Claire King https://www.blackhatworld.com/goto/post?id=13124862 is a liar. He using a C code not Modern C++. If you go my previous posts, you can see two liner code for a HTTP request in Modern C++.

Code:
#include <iostream>
#include <cpr.h>

int main() {   

     auto response = cpr::Get(cpr::Url{"https://www.google.com"});

     std::cout << response.text << std::endl;

}

You can't possibly build a bot in 10 min. It's not rational. Programmers have to think which takes time.

I would say Javascript can beat Python in terms of development speed.

Other than that, C++ has adequate development speed for creating bots with a headless browser.

In most cases, C++ will trumps over Python in terms of development speed.

You get type checking with C++. Lesser errors to debug.
 
C++ is easier.

For example, here how you can spawn a headless browser from C++ and control it from C++

Code
https://source.chromium.org/chromium/chromium/src/+/master:headless/app/headless_example.cc
Instructions
https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md




Claire King is a liar. He using a C code not Modern C++. If you go my previous posts, you can see two liner code for a HTTP request in Modern C++.

You can't possibly build a bot in 10 min. It's not rational. Programmers have to think which takes time.

I would say Javascript can beat Python in terms of development speed.

Other than that, C++ has adequate development speed for creating bots with a headless browser.

In most cases, C++ will trumps over Python in terms of development speed.

You get type checking with C++. Lesser errors to debug.
Yet I do often just make those simple bots in 10 mins. How? Copy paste half of the file, then find out xpath from browser... And implement. Yeah but making a complicated bot will obviously take more time.
 
Yet I do often just make those simple bots in 10 mins. How? Copy paste half of the file, then find out xpath from browser... And implement. Yeah but making a complicated bot will obviously take more time.

Often means varies. Varies means not always. It's a probabilistic statement.

It's like that book Teach Yourself C++ in 24 Hours.
 
Often means varies. Varies means not always. It's a probabilistic statement.

It's like that book Teach Yourself C++ in 24 Hours.
Lolz. It depends on how complex the problem is, and how many steps does it take to solve the problem. Sounds similar?
 
Lolz. It depends on how complex the problem is, and how many steps does it take to solve the problem. Sounds similar?

I was originally a C++ hater .because of other people's soviet style propaganda against this language.

The way you compare is dishonest. It lure newbies into Python because you said you can make a bot in 10 min.

They don't see your other words.

You need to compare a real world one not a Hello World XPath copy pasta.

Few weeks ago, a man came to reddit's CPP sub and apologized everyone for hating C++

Aaaaaand what he is a Python programmer. He realized how easy C++ compared to Python.

The OP asked whether C++ is a good language for making a bot, I answered that question while other people bashing how horrible or hard C++ is.

The OP is a Javascript programmer so transition from JS -> C++ is easy since JS originally built for C++ programmers.

There is even a talk about it,


FYI, Both JS (ECMAScript ) and C++ are C-Family Languages.

https://en.wikipedia.org/wiki/List_of_C-family_programming_languages
 
I was originally a C++ hater .because of other people's soviet style propaganda against this language.

The way you compare is dishonest. It lure newbies into Python because you said you can make a bot in 10 min.

They don't see your other words.

You need to compare a real world one not a Hello World XPath copy pasta.

Few weeks ago, a man came to reddit's CPP sub and apologized everyone for hating C++

Aaaaaand what he is a Python programmer. He realized how easy C++ compared to Python.

The OP asked whether C++ is a good language for making a bot, I answered that question while other people bashing how horrible or hard C++ is.

The OP is a Javascript programmer so transition from JS -> C++ is easy since JS originally built for C++ programmers.

There is even a talk about it,


FYI, Both JS (ECMAScript ) and C++ are C-Family Languages.

https://en.wikipedia.org/wiki/List_of_C-family_programming_languages
Are you on drugs? I was the one who said c++ is faster than python. Rofl. Of course i said i can make a python bot in 10 mins. I am not wrong about it. Been coding for 12 years. Do you think I will not have enough snippets to make it work quickly?
 
Are you on drugs? I was the one who said c++ is faster than python. Rofl. Of course i said i can make a python bot in 10 mins. I am not wrong about it. Been coding for 12 years. Do you think I will not have enough snippets to make it work quickly?

No. You said C++ has faster performance and slow development speed. While the former is true and the latter is incorrect. I disputed your "slow development speed" argument.
 
No. You said C++ has faster performance and slow development speed. While the former is true and the latter is incorrect. I disputed your "slow development speed" argument.
Where? Show me.
 
Where? Show me.

Easy peasy.

You appreciated C++ performance here,

Please consider the speed implications of using python if you are going to make a large project. Yes, python is pretty minimal; but it sure has problems. It has problem with loops, threading and whatnot.

You bashed C++ here for development speed,

That said, for making a bot in 10 minutes; nothing can beat python.
 
And then there is me:
tumblr_ljh0puClWT1qfkt17.gif


who uses,
- Vue & PHP for control panel
- Python for machine learning and AI
- Node for asynchronous tasks and browser emulation
- C++ for some heavy-duty scraping & API penetrating


It's not about which tool is better.

But where to use it.


if there will be a java based tool that can help me, I will add java to this stack as well, w/o blink of an eye.
 
Last edited:
Easy peasy.

You appreciated C++ performance here,

Please consider the speed implications of using python if you are going to make a large project. Yes, python is pretty minimal; but it sure has problems. It has problem with loops, threading and whatnot.

You bashed C++ here for development speed,

That said, for making a bot in 10 minutes; nothing can beat python.
Saying python is minimal doesn't necessarily say c++ isn't. Makes sense?

I guess you have no idea about python. It's ok, but please man... Don't talk rubbish.

Also, stop putting words into my mouth that i did not say.

And then there is me:


It's not about which tool is better.

But where to use it.


if there will be a java based tool that can help me, I will add java to this stack as well, w/o blink of an eye.
This freaking sums up the thread lol. As I'd also say, use the best tool for the job. If it takes 10 mins, don't stretch it for an hour trying to code more efficiently, especially if speed is not a concern.
 
Last edited:
Back
Top