Re: [Vala] vala-list Digest, Vol 133, Issue 6

2019-02-16 Thread Fernando Silva via vala-list
I think checking if (the_datum != null) should do

Em sáb, 16 de fev de 2019 10:00,  Send vala-list mailing list submissions to
> vala-list@gnome.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.gnome.org/mailman/listinfo/vala-list
> or, via email, send a message with subject or body 'help' to
> vala-list-requ...@gnome.org
>
> You can reach the person managing the list at
> vala-list-ow...@gnome.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of vala-list digest..."
>
>
> Today's Topics:
>
>1. error: use of possibly unassigned local variable (Vivien Kraus)
>
>
> --
>
> Message: 1
> Date: Fri, 15 Feb 2019 21:28:45 +0100
> From: Vivien Kraus 
> To: vala-list@gnome.org
> Subject: [Vala] error: use of possibly unassigned local variable
> Message-ID:
> <40a1141df0d06b59ed0f87f3a6cafac285f45b4a.ca...@planete-kraus.eu>
> Content-Type: text/plain; charset="UTF-8"
>
> Hello list,
>
> I am facing an inconvenient problem.
>
> Suppose I have a C library, that I want to use from vala:
>
> // Always return true
> extern bool lib_initialized ();
>
> // data is always set when work returns true
> extern bool lib_work (out int data);
>
> int main(string[] args) {
> int the_datum;
> bool has_datum = (lib_initialized () && lib_work (out the_datum));
> if (has_datum) {
> stdout.printf ("Hello, %d!\n", the_datum);
> }
> return 0;
> }
>
> If I am to compile this (0.42.5, -C only, not link), I get an error
> message:
>
> test.vala:11.3-11.44: error: use of possibly unassigned local variable
> `the_datum'
> stdout.printf ("Hello, %d!\n", the_datum);
> ^^
> Compilation failed: 1 error(s), 0 warning(s)
>
> The workaround is obvious: initialize the_datum.  However, I like to run
> my code under valgrind to detect when reading
> from an uninitialized variable (I make lots of mistakes ^^), and so if
> there is a bug in lib_work and I initialize
> the_datum, then I will not be able to notice the problem.
>
> Is it possible to instruct valac that it should not worry?  Or is it
> possible to change this error to a simple warning?
>
> Best regards
>
> Vivien
>
>
>
>
> --
>
> Subject: Digest Footer
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
>
> --
>
> End of vala-list Digest, Vol 133, Issue 6
> *
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] vala-list Digest, Vol 124, Issue 13

2018-03-28 Thread Fernando Silva
I bet this could be decided based on locale with gettext

2018-03-28 9:00 GMT-03:00 :

> Send vala-list mailing list submissions to
> vala-list@gnome.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.gnome.org/mailman/listinfo/vala-list
> or, via email, send a message with subject or body 'help' to
> vala-list-requ...@gnome.org
>
> You can reach the person managing the list at
> vala-list-ow...@gnome.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of vala-list digest..."
>
>
> Today's Topics:
>
>1. Re: Date format (rastersoft)
>2. Re: Date format (Al Thomas)
>
>
> --
>
> Message: 1
> Date: Wed, 28 Mar 2018 12:50:31 +0200
> From: rastersoft 
> To: Al Thomas , vala-list@gnome.org
> Subject: Re: [Vala] Date format
> Message-ID: 
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> Hi:
>
> > > Also, what
> > > I really want is the date in the format "March 5, 2018", not
> > "03/05/18",
> > > but it seems that only %c does that, but adds a lot of extra data
> > that I
> > > don't want like the time zone.
> >
> > As Christian Hergert suggests, DateTime is very useful. This works for
> me:
> >
> > void main () {
> > ??? var date = new DateTime.now_local();
> > ??? print (date.format("%B %e, %Y"));
> > }
> >
> > That prints March 28, 2018 today. There are a whole load of formatting
>
> Yes, but the problem is that, in Spain, we use the opposite format: we
> write first the day's number, then the month's name, and finally the
> year, so I need to know if in my current locale I have to "%B %e, %Y",
> or "%e %B %Y" (without the comma), and so on... That's my problem. Using
> '%c' does that, but adds a lot of extra information that I don't want,
> like the timezone.
>
>
> --
>
> Message: 2
> Date: Wed, 28 Mar 2018 11:53:28 + (UTC)
> From: Al Thomas 
> To: vala-list@gnome.org, rastersoft 
> Subject: Re: [Vala] Date format
> Message-ID: <1758071266.393914.1522238008...@mail.yahoo.com>
> Content-Type: text/plain; charset=UTF-8
>
>   On Wednesday, 28 March 2018, 11:50:33 BST, rastersoft <
> ras...@rastersoft.com> wrote: > Yes, but the problem is that, in Spain,
> we use the opposite format: we write first the day's number, > then the
> month's name, and finally the year, so I need to know if in my current
> locale I have > to "%B %e, %Y", or "%e %B %Y" (without the comma), and so
> on... That's my problem. > Using '%c' does that, but adds a lot of extra
> information that I don't want, like the timezone.
> Aha, I understand now. I don't know the answer. There doesn't appear to be
> a ready madesolution. I would say that here in the UK the format 28 March
> 2018 is often used. The same asin Spain. I know that in the USA a date
> written as 5/3/2018 is the same as 3/5/2018 in the UK(03 May 2018). So
> generally I go for day of the month, followed by word of the month and full
> year.This at least helps makes the date unambiguous for the Gregorian
> calendar. As long as thereader can distinguish the day, month and year.
>
> I do also know that styles can change over time. So often in the UK a
> datewas written 3rd May 2018. Then some years ago it was decided in my
> workplace that this was tooold fashioned and it was changed to 3 May 2018.
> This was for a public service dealing with millions of contacts a year from
> all over the UK. Now I'm often seeing 03 May 2018.
> May be it is just open to too much variation that it has never been coded
> in to a library. Inessence it is better to convey the meaning of the date
> unambiguously rather that meet thestylistic requirements of any locale.
> I'm curious about the ordering of day, month, year for the Gregorian
> calendar in other locales and if there is a library for that.
> Regards,
> Al
>
>
>
> --
>
> Subject: Digest Footer
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
>
> --
>
> End of vala-list Digest, Vol 124, Issue 13
> **
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list