maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #09909
Re: Sachin weekly report
Hi Sachim,
Sergei's suggestion with STRING_WITH_LEN macro or sizeof("string") should
fix the problem you're raising.
Regards,
Vicentiu
On Fri, 26 Aug 2016 at 18:11 Sachin Setia <sachinsetia1001@xxxxxxxxx> wrote:
> Hi Vicențiu
>
> Thanks Vicențiu for your comment. Although I agree with you but defining
> #define HA_HASH_STR_LEN 4
> or
> const int HA_HASH_STR_LEN = 4;
>
> make it independent of length of "hash". Although we rarely gone
> change "hash", so I think it
> is a good idea. What do you think , Sergei?
> Regards
> sachin
>
> On Fri, Aug 26, 2016 at 7:26 PM, Vicențiu Ciorbaru <vicentiu@xxxxxxxxxxx>
> wrote:
> > Hi Sachin, Sergei!
> >
> > One quick thing I wanted to point out. I did not specifically look at how
> > things get called, but,
> > when defining constants, I don't agree with:
> >
> >> > +#define HA_HASH_STR_LEN strlen(HA_HASH_STR)
> >
> > Or:
> >>
> >> > +#define HA_HASH_STR_INDEX_LEN strlen(HA_HASH_STR_INDEX)
> >
> >
> > This hides an underlying strlen. Better make it a real constant value.
> > Perhaps the compiler is smart enough to optimize it away, but why risk
> it?
> >
> > Another one is why not define them as const char * and const int? This
> also
> > helps during debugging, as you can do:
> >
> > (gdb) $ print HA_HAST_STR_INDEX_LEN
> >
> > I know that a lot of the code makes use of defines with #define, but why
> not
> > enforce a bit of type safety while we're at it?
> >
> > Just my 2 cents, feel free to disagree. :)
> > Vicentiu
> >
> >
>
Follow ups
References
-
Re: Sachin weekly report
From: Sergei Golubchik, 2016-06-14
-
Re: Sachin weekly report
From: Sachin Setia, 2016-06-20
-
Re: Sachin weekly report
From: Sachin Setia, 2016-06-26
-
Re: Sachin weekly report
From: Sachin Setia, 2016-07-05
-
Re: Sachin weekly report
From: Sergei Golubchik, 2016-07-11
-
Re: Sachin weekly report
From: sachin setiya, 2016-08-13
-
Re: Sachin weekly report
From: Sachin Setia, 2016-08-13
-
Re: Sachin weekly report
From: Sergei Golubchik, 2016-08-24
-
Re: Sachin weekly report
From: Vicențiu Ciorbaru, 2016-08-26
-
Re: Sachin weekly report
From: Sachin Setia, 2016-08-26