3bc-lang icon indicating copy to clipboard operation
3bc-lang copied to clipboard

remove all 'for' loops from source code

Open RodrigoDornelles opened this issue 2 years ago • 2 comments

by the ANSI standard the first field of for ends up not being used to instantiate variables, besides using while would be something simpler and more readable to maintain.

before

int i = 0;

for (; i < sizeof(any); i++) {
   /** code **/
}

after

int i = 0;

while(i < sizeof(any)) {
   /** code **/
   i += 1;
}

RodrigoDornelles avatar Sep 12 '22 12:09 RodrigoDornelles

Hey, where exactly do you want these changes to be done?

ramyashreeshetty avatar Sep 12 '22 18:09 ramyashreeshetty

Hey, where exactly do you want these changes to be done?

Hi @ramyashreeshetty !

for all the source code, keep only do while and while

if you want to contribute just replace each for with a while, and keep the indentation for the linter to approve.

RodrigoDornelles avatar Sep 13 '22 12:09 RodrigoDornelles

Hello, @RodrigoDornelles is this issue still active?

Yugal41735 avatar Oct 16 '22 16:10 Yugal41735

Hello, @RodrigoDornelles is this issue still active?

Yes.

RodrigoDornelles avatar Oct 16 '22 19:10 RodrigoDornelles

So, for this issue I basically have to just replace for with while, and where exactly I had to do this? Like is there any specific file that you could point to? @RodrigoDornelles

Yugal41735 avatar Oct 17 '22 04:10 Yugal41735

So, for this issue I basically have to just replace for with while, and where exactly I had to do this? Like is there any specific file that you could point to? @RodrigoDornelles

all there´s!

RodrigoDornelles avatar Oct 17 '22 16:10 RodrigoDornelles

So, like do I have to visit every single file, and if there's a for loop present then I have to replace it with while? @RodrigoDornelles

Yugal41735 avatar Oct 17 '22 18:10 Yugal41735

So, like do I have to visit every single file, and if there's a for loop present then I have to replace it with while?

browse the code or use a search tool, all sources are in the src/ path, just apply a similar iteration to for() using while() keeping the initial behavior.

RodrigoDornelles avatar Oct 17 '22 18:10 RodrigoDornelles

@RodrigoDornelles I had created the pr regarding the same, you could review it.

Yugal41735 avatar Oct 18 '22 04:10 Yugal41735

I had created the pr regarding the same, you could review it.

Tanks!

I've reviewed it, if u make some small changes I'll run the automatic tests to merge.

RodrigoDornelles avatar Oct 18 '22 12:10 RodrigoDornelles