Pablochaches
Pablochaches

Reputation: 1068

Is there a way to substitute all definitions of functions where they are used and to automatically change variables names in my source code?

I know this is a really weird question, but I have my reasons.

During the last year and the beginning of this one, at school they are teaching us about programming (C++ and VB). We are aspiring to be "baccalaureates" (I googled the English term) in computing. But during my vacations I started studying programming (in the CS50 course). I was amazed at how one full year of "learning" programming was taught in 1 hour of the course.

At this moment, we have been assigned to make a system that will help a company store data from multiple clients and products, and make invoices. (They havent taught us about file IO, so no storing the data).

I have taken an OOP approach, but now that I'm about to finish, I have started thinking about my classmates. Now I have around 500 lines of code (in the classes and functions I will use), and I am wondering how will they do it, because if I only use what they taught us, I will be only using cin, cout, if, and for to do the whole program, I wouldn't even be able to use functions. I would have named my variables a, b, c, d, a2, b2, c2, d2.

So I was wondering if there was a way for me to turn my code into that, substitute all the definions of the functions where I'm using them, change the names of the variables to have no meaning, and I don't know what would happen to the classes. I have googled it but all things that pop up are either about clean code or about questions people have.

Is there a way to tell the compiler to substitute that stuff, or to have a site do it for me? Or is my only option is to do it by hand?

Upvotes: 1

Views: 64

Answers (1)

mltechi
mltechi

Reputation: 96

That seems very much like a custom job. you will have to do this by hand.

That being said, there are ways in making that much easier. I personally use Visual Studios Code for some of my quick cpp scripts like the one you have written. This will help you rename symbols and format your code to your liking.

Hope this helps.

Upvotes: 2

Related Questions